summaryrefslogtreecommitdiff
path: root/src/lib/efl_wl
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-07-12 12:00:52 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-07-12 11:59:20 -0400
commitc6f41d8e10515f214e6a27237e927280e4bb3957 (patch)
tree92d3cc705154a201928084c6fb0e021c238b28b5 /src/lib/efl_wl
parent8c2afaf251d5b65c82723be22ba2c23913343bef (diff)
efl-wl: check return of ecore_main_fd_handler_fd_get
CID 1377541, 1377546, 1377519, 1377529, 1377543
Diffstat (limited to 'src/lib/efl_wl')
-rw-r--r--src/lib/efl_wl/efl_wl.c10
-rw-r--r--src/lib/efl_wl/x11.x19
2 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c
index 99509deda5..a119b9c735 100644
--- a/src/lib/efl_wl/efl_wl.c
+++ b/src/lib/efl_wl/efl_wl.c
@@ -395,8 +395,11 @@ tiler_new(void)
395static inline void 395static inline void
396fdh_del(Ecore_Fd_Handler *fdh) 396fdh_del(Ecore_Fd_Handler *fdh)
397{ 397{
398 int fd;
398 if (!fdh) return; 399 if (!fdh) return;
399 close(ecore_main_fd_handler_fd_get(fdh)); 400 fd = ecore_main_fd_handler_fd_get(fdh);
401 if (fd >= 0)
402 close(fd);
400 ecore_main_fd_handler_del(fdh); 403 ecore_main_fd_handler_del(fdh);
401} 404}
402 405
@@ -1004,8 +1007,11 @@ data_device_selection_read(void *d, Ecore_Fd_Handler *fdh)
1004 do 1007 do
1005 { 1008 {
1006 unsigned char buf[2048]; 1009 unsigned char buf[2048];
1010 int fd;
1007 1011
1008 len = read(ecore_main_fd_handler_fd_get(fdh), buf, sizeof(buf)); 1012 fd = ecore_main_fd_handler_fd_get(fdh);
1013 if (fd < 0) break;
1014 len = read(fd, buf, sizeof(buf));
1009 if (len > 0) 1015 if (len > 0)
1010 { 1016 {
1011 if (!ds->reader_data) 1017 if (!ds->reader_data)
diff --git a/src/lib/efl_wl/x11.x b/src/lib/efl_wl/x11.x
index 75a1da7b96..892b167d35 100644
--- a/src/lib/efl_wl/x11.x
+++ b/src/lib/efl_wl/x11.x
@@ -25,7 +25,9 @@ typedef struct
25static void 25static void
26_pipe_free(Pipe *p) 26_pipe_free(Pipe *p)
27{ 27{
28 close(ecore_main_fd_handler_fd_get(p->fdh)); 28 int fd = ecore_main_fd_handler_fd_get(p->fdh);
29 if (fd >= 0)
30 close(fd);
29 ecore_main_fd_handler_del(p->fdh); 31 ecore_main_fd_handler_del(p->fdh);
30 eina_binbuf_free(p->buf); 32 eina_binbuf_free(p->buf);
31 free(p); 33 free(p);
@@ -57,9 +59,11 @@ x11_offer_write(void *data, Ecore_Fd_Handler *fdh)
57 59
58 if (ecore_main_fd_handler_active_get(fdh, ECORE_FD_WRITE)) 60 if (ecore_main_fd_handler_active_get(fdh, ECORE_FD_WRITE))
59 { 61 {
60 len = write(ecore_main_fd_handler_fd_get(fdh), 62 int fd = ecore_main_fd_handler_fd_get(fdh);
61 eina_binbuf_string_get(dt->source->reader_data) + dt->offset, 63 if (fd >= 0)
62 eina_binbuf_length_get(dt->source->reader_data) - dt->offset); 64 len = write(fd,
65 eina_binbuf_string_get(dt->source->reader_data) + dt->offset,
66 eina_binbuf_length_get(dt->source->reader_data) - dt->offset);
63 if (len > 0) dt->offset += len; 67 if (len > 0) dt->offset += len;
64 } 68 }
65 69
@@ -237,11 +241,14 @@ static Eina_Bool
237x11_pipe_read(void *data, Ecore_Fd_Handler *fdh) 241x11_pipe_read(void *data, Ecore_Fd_Handler *fdh)
238{ 242{
239 Pipe *p = data; 243 Pipe *p = data;
240 ssize_t len; 244 ssize_t len = -1;
241 unsigned char *buf; 245 unsigned char *buf;
246 int fd;
242 247
243 buf = malloc(INCR_CHUNK_SIZE); 248 buf = malloc(INCR_CHUNK_SIZE);
244 len = read(ecore_main_fd_handler_fd_get(fdh), (void*)buf, INCR_CHUNK_SIZE); 249 fd = ecore_main_fd_handler_fd_get(fdh);
250 if (fd >= 0)
251 len = read(fd, (void*)buf, INCR_CHUNK_SIZE);
245 if (len < 0) 252 if (len < 0)
246 { 253 {
247 free(buf); 254 free(buf);