diff options
author | Havoc Pennington <hp@redhat.com> | 2005-01-21 03:47:21 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2005-01-21 03:47:21 +0000 |
commit | 9dd0367977c7868380a134ef1b3e9e6d7d3a0bb5 (patch) | |
tree | 402808b4b039a79568ebb4d9b488d89dba4f82eb | |
parent | f5cf675641e63cefc36c8a9a7a5872cc8600abcd (diff) |
2005-01-20 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.c (_dbus_poll): fix several bugs in the
select() version, patches from Tor Lillqvist
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | dbus/dbus-sysdeps.c | 33 |
2 files changed, 22 insertions, 16 deletions
@@ -1,5 +1,10 @@ 2005-01-20 Havoc Pennington <hp@redhat.com> + * dbus/dbus-sysdeps.c (_dbus_poll): fix several bugs in the + select() version, patches from Tor Lillqvist + +2005-01-20 Havoc Pennington <hp@redhat.com> + * doc/dbus-tutorial.xml: replace > with > * bus/services.c (bus_registry_acquire_service): validate the name diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index d951a8d6..96bf3fea 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -1840,40 +1840,41 @@ _dbus_poll (DBusPollFD *fds, for (i = 0; i < n_fds; i++) { - DBusPollFD f = fds[i]; + DBusPollFD *fdp = fds[i]; - if (f.events & _DBUS_POLLIN) - FD_SET (f.fd, &read_set); + if (fdp->events & _DBUS_POLLIN) + FD_SET (fdp->fd, &read_set); - if (f.events & _DBUS_POLLOUT) - FD_SET (f.fd, &write_set); + if (fdp->events & _DBUS_POLLOUT) + FD_SET (fdp->fd, &write_set); - FD_SET (f.fd, &err_set); + FD_SET (fdp->fd, &err_set); - max_fd = MAX (max_fd, f.fd); + max_fd = MAX (max_fd, fdp->fd); } tv.tv_sec = timeout_milliseconds / 1000; tv.tv_usec = (timeout_milliseconds % 1000) * 1000; - ready = select (max_fd + 1, &read_set, &write_set, &err_set, &tv); + ready = select (max_fd + 1, &read_set, &write_set, &err_set, + timeout_milliseconds < 0 ? NULL : &tv); if (ready > 0) { 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; } } |