From: Jaap Boender Date: Wed, 11 Jun 2014 10:14:10 +0000 (+0100) Subject: Don't call poll(2) with timeout < -1 X-Git-Tag: dbus-1.9.0~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=be241064f806192e6c452a9514fa5ecab14306f5;p=thirdparty%2Fdbus.git 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 --- diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index 17b4a8d8f..170d8650e 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);