]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Don't call poll(2) with timeout < -1
authorJaap Boender <jaapb@kerguelen.org>
Wed, 11 Jun 2014 10:14:10 +0000 (11:14 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 11 Jun 2014 10:15:24 +0000 (11:15 +0100)
On Linux, poll accepts any negative value as infinity.
On at least FreeBSD and NetBSD, only -1 is acceptable.

[adjusted whitespace for correct coding style -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78480
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-sysdeps-unix.c

index 17b4a8d8f8fe2ee5deed3c0586bf665b01d39484..170d8650e59fbd0934bf7783f8357013343a61cc 100644 (file)
@@ -2573,6 +2573,11 @@ _dbus_poll (DBusPollFD *fds,
       _DBUS_STRUCT_OFFSET (DBusPollFD, revents) ==
       _DBUS_STRUCT_OFFSET (struct pollfd, revents))
     {
+      if (timeout_milliseconds < -1)
+        {
+          timeout_milliseconds = -1;
+        }
+
       return poll ((struct pollfd*) fds,
                    n_fds,
                    timeout_milliseconds);