diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-07-12 12:00:52 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-07-12 11:59:20 -0400 |
commit | c6f41d8e10515f214e6a27237e927280e4bb3957 (patch) | |
tree | 92d3cc705154a201928084c6fb0e021c238b28b5 | |
parent | 8c2afaf251d5b65c82723be22ba2c23913343bef (diff) | |
download | efl-c6f41d8e10515f214e6a27237e927280e4bb3957.tar.gz |
efl-wl: check return of ecore_main_fd_handler_fd_get
CID 1377541, 1377546, 1377519, 1377529, 1377543
-rw-r--r-- | src/lib/efl_wl/efl_wl.c | 10 | ||||
-rw-r--r-- | src/lib/efl_wl/x11.x | 19 |
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) static inline void fdh_del(Ecore_Fd_Handler *fdh) { + int fd; if (!fdh) return; - close(ecore_main_fd_handler_fd_get(fdh)); + fd = ecore_main_fd_handler_fd_get(fdh); + if (fd >= 0) + close(fd); ecore_main_fd_handler_del(fdh); } @@ -1004,8 +1007,11 @@ data_device_selection_read(void *d, Ecore_Fd_Handler *fdh) do { unsigned char buf[2048]; + int fd; - len = read(ecore_main_fd_handler_fd_get(fdh), buf, sizeof(buf)); + fd = ecore_main_fd_handler_fd_get(fdh); + if (fd < 0) break; + len = read(fd, buf, sizeof(buf)); if (len > 0) { 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 static void _pipe_free(Pipe *p) { - close(ecore_main_fd_handler_fd_get(p->fdh)); + int fd = ecore_main_fd_handler_fd_get(p->fdh); + if (fd >= 0) + close(fd); ecore_main_fd_handler_del(p->fdh); eina_binbuf_free(p->buf); free(p); @@ -57,9 +59,11 @@ x11_offer_write(void *data, Ecore_Fd_Handler *fdh) if (ecore_main_fd_handler_active_get(fdh, ECORE_FD_WRITE)) { - len = write(ecore_main_fd_handler_fd_get(fdh), - eina_binbuf_string_get(dt->source->reader_data) + dt->offset, - eina_binbuf_length_get(dt->source->reader_data) - dt->offset); + int fd = ecore_main_fd_handler_fd_get(fdh); + if (fd >= 0) + len = write(fd, + eina_binbuf_string_get(dt->source->reader_data) + dt->offset, + eina_binbuf_length_get(dt->source->reader_data) - dt->offset); if (len > 0) dt->offset += len; } @@ -237,11 +241,14 @@ static Eina_Bool x11_pipe_read(void *data, Ecore_Fd_Handler *fdh) { Pipe *p = data; - ssize_t len; + ssize_t len = -1; unsigned char *buf; + int fd; buf = malloc(INCR_CHUNK_SIZE); - len = read(ecore_main_fd_handler_fd_get(fdh), (void*)buf, INCR_CHUNK_SIZE); + fd = ecore_main_fd_handler_fd_get(fdh); + if (fd >= 0) + len = read(fd, (void*)buf, INCR_CHUNK_SIZE); if (len < 0) { free(buf); |