Pārlūkot izejas kodu

[LibOS] Ignore POLLERR and POLLHUP in `events` in poll()

See #389.

Per the manpage, POLLERR and POLLUP are returned in `revents` and
ignored in `events`.  Indeed, programs should not be setting, and
typically don't set -- `events` with these values.

The effect of this bug is, among others, that a process will never get a
disconnect event from a peer socket.
smherwig 6 gadi atpakaļ
vecāks
revīzija
5c42c026c6
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      LibOS/shim/src/sys/shim_poll.c

+ 1 - 1
LibOS/shim/src/sys/shim_poll.c

@@ -420,7 +420,7 @@ int shim_do_poll (struct pollfd * fds, nfds_t nfds, int timeout)
         if (polls[i].flags & RET_W)
             fds[i].revents |= (fds[i].events & (POLLOUT|POLLWRNORM));
         if (polls[i].flags & RET_E)
-            fds[i].revents |= (fds[i].events & (POLLERR|POLLHUP));
+            fds[i].revents |= (POLLERR|POLLHUP);
 
         if (fds[i].revents)
             ret++;