From be241064f806192e6c452a9514fa5ecab14306f5 Mon Sep 17 00:00:00 2001 From: Jaap Boender Date: Wed, 11 Jun 2014 11:14:10 +0100 Subject: [PATCH] Don't call poll(2) with timeout < -1 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 --- dbus/dbus-sysdeps-unix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 17b4a8d8..170d8650 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -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);