Bug 78480 - poll(2) should not be called with negative timeout under NetBSD
Summary: poll(2) should not be called with negative timeout under NetBSD
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: All NetBSD
: medium normal
Assignee: Havoc Pennington
QA Contact:
URL:
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-05-09 09:32 UTC by Jaap Boender
Modified: 2014-06-11 10:58 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Patch to dbus/dbus-sysdeps-unix.c fixing the issue. (655 bytes, text/plain)
2014-05-09 09:32 UTC, Jaap Boender
Details

Description Jaap Boender 2014-05-09 09:32:39 UTC
Created attachment 98740 [details]
Patch to dbus/dbus-sysdeps-unix.c fixing the issue.

There seems to be a difference between the behaviour of poll(2) under NetBSD (at least) and other operating systems; under Linux, for example, any negative timeout is treated as an indefinite block, whereas NetBSD only accepts -1, any other negative value resulting in an EINVAL.

(This is a real issue: with an unpatched version of dbus, KDE refuses to start.)

A patch fixing this issue is attached; it should be portable, as it simply maps any negative timeout to -1.
Comment 1 Simon McVittie 2014-05-09 13:44:50 UTC
Which caller is getting this wrong? I would expect callers of _dbus_poll() to use the portable "timeout >= -1" version.

That patch can't hurt, though. I'll apply it when I next do dbus test-builds, and it's appropriate for "ports" or distro packaging.

Coding style nitpicking: D-Bus is in approximately GNOME style (which is itself approximately GNU style), so the {} and their contents should be indented by 2 more spaces.
Comment 2 Simon McVittie 2014-06-11 10:58:37 UTC
Fixed in git for 1.9.0, and appropriate to backport in *BSD ports/packages/whatever.

As a note for the future, we prefer "git format-patch" output so that it's clear how the author prefers to be named.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.