efl-wl: check return of ecore_main_fd_handler_fd_get

CID 1377541, 1377546, 1377519, 1377529, 1377543
This commit is contained in:
Mike Blumenkrantz 2017-07-12 12:00:52 -04:00
parent 8c2afaf251
commit c6f41d8e10
2 changed files with 21 additions and 8 deletions

View File

@ -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)

View File

@ -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);