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 <simon.mcvittie@collabora.co.uk>
This commit is contained in:
Jaap Boender 2014-06-11 11:14:10 +01:00 committed by Simon McVittie
parent 980ef1d534
commit be241064f8

View 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);