wl dnd - check socketpair and fcntl return values

fix CID 1403951
This commit is contained in:
Carsten Haitzler 2019-08-06 18:30:30 +01:00
parent a536c8a6a2
commit 1c893b064f
1 changed files with 23 additions and 14 deletions

View File

@ -456,9 +456,17 @@ _xwl_selection_request(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Event_Sel
E_Client *ec;
int fds[2];
if (socketpair(AF_UNIX, (SOCK_STREAM | SOCK_CLOEXEC), 0, fds) != 0)
break;
if (fcntl(fds[0], F_SETFL, O_NONBLOCK) != 0)
{
close(fds[0]);
close(fds[1]);
break;
}
p = E_NEW(Pipe, 1);
socketpair(AF_UNIX, (SOCK_STREAM | SOCK_CLOEXEC), 0, fds);
fcntl(fds[0], F_SETFL, O_NONBLOCK);
if (p)
{
p->fdh = ecore_main_fd_handler_add(fds[0], ECORE_FD_READ, _xwl_pipe_read, p, NULL, NULL);
p->win = ev->requestor;
p->source = source;
@ -471,6 +479,7 @@ _xwl_selection_request(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_X_Event_Sel
if (ec && ec->override)
ecore_x_window_sniff(ev->requestor);
eina_hash_add(pipes, &p->win, p);
}
break;
}
}