From: Michael Tremer Date: Fri, 16 Dec 2022 10:23:48 +0000 (+0000) Subject: jail: epoll: Only register for the operations we actually need X-Git-Tag: 0.9.29~416 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e48beb249173285d9039d66e2de6591b943a887c;p=pakfire.git jail: epoll: Only register for the operations we actually need Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index c53dce035..20785045e 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -641,8 +641,6 @@ static int pakfire_jail_wait(struct pakfire_jail* jail, struct pakfire_jail_exec goto ERROR; } - ev.events = EPOLLIN|EPOLLOUT|EPOLLHUP; - // Turn file descriptors into non-blocking mode and add them to epoll() for (unsigned int i = 0; i < sizeof(fds) / sizeof(*fds); i++) { int fd = fds[i]; @@ -651,6 +649,13 @@ static int pakfire_jail_wait(struct pakfire_jail* jail, struct pakfire_jail_exec if (fd <= 0) continue; + ev.events = EPOLLHUP; + + if (fd == stdin) + ev.events |= EPOLLOUT; + else + ev.events |= EPOLLIN; + // Read flags int flags = fcntl(fd, F_GETFL, 0);