Bug in _dbus_poll() without HAVE_POLL?

Tor Lillqvist tml@iki.fi
Tue Jan 18 06:18:02 PST 2005


Check what the code does after select() has returned with ready >
0. It sets the revents field in a *local copy* of each
DBusPollFD. Surely that can't be correct? Suggested patch below.

--tml

Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.88
diff -p -u -2 -r1.88 dbus-sysdeps.c
--- dbus-sysdeps.c      17 Jan 2005 03:53:40 -0000      1.88
+++ dbus-sysdeps.c      18 Jan 2005 13:34:35 -0000
@@ -1863,16 +1863,16 @@ _dbus_poll (DBusPollFD *fds,
       for (i = 0; i < n_fds; i++)
        {
-         DBusPollFD f = fds[i];
+         DBusPollFD *fdp = fds + i;

-         f.revents = 0;
+         fdp->revents = 0;

-         if (FD_ISSET (f.fd, &read_set))
-           f.revents |= _DBUS_POLLIN;
+         if (FD_ISSET (fdp->fd, &read_set))
+           fdp->revents |= _DBUS_POLLIN;

-         if (FD_ISSET (f.fd, &write_set))
-           f.revents |= _DBUS_POLLOUT;
+         if (FD_ISSET (fdp->fd, &write_set))
+           fdp->revents |= _DBUS_POLLOUT;

-         if (FD_ISSET (f.fd, &err_set))
-           f.revents |= _DBUS_POLLERR;
+         if (FD_ISSET (fdp->fd, &err_set))
+           fdp->revents |= _DBUS_POLLERR;
        }
     }




More information about the dbus mailing list