evpoll: Always initialize revents for the output

Even if we have not selected the fd (e.g. fd < 0), initialize revents
to 0. This seems to match gpoll.c:g_poll of glib.

Change-Id: I9e16a6d5a74a204c85808ba67a8f0f7af3045059
changes/96/1796/1
Holger Hans Peter Freyther 6 years ago
parent 70926c8bb5
commit e19f9ce39f
  1. 3
      src/evpoll.c

@ -92,10 +92,11 @@ int evpoll(struct pollfd *fds, nfds_t nfds, int timeout)
osmo_fd_disp_fds(&readset, &writeset, &exceptset);
for (i = 0; i < nfds; ++i) {
fds[i].revents = 0;
if (fds[i].fd < 0)
continue;
fds[i].revents = 0;
if (FD_ISSET(fds[i].fd, &readset))
fds[i].revents = POLLIN;
if (FD_ISSET(fds[i].fd, &writeset))

Loading…
Cancel
Save