From 0e36cdd54964c4012acec2bb8e598b85e82d2846 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 10 Jul 2009 21:33:02 -0400 Subject: Bug 896 - Avoid race conditions reading message from exited process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch based on extensive work from Michael Meeks , thanks to Dafydd Harries , Kimmo Hämäläinen and others. The basic idea with this bug is that we effectively ignore errors on write. Only when we're done reading from a connection do we close down a connection. This avoids a race condition where if a process (such as dbus-send) exited while we still had data to read in the buffer, we'd miss that data. --- dbus/dbus-watch.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dbus/dbus-watch.c') diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index 7ef27bf0..bca699fd 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -51,6 +51,12 @@ struct DBusWatch unsigned int enabled : 1; /**< Whether it's enabled. */ }; +dbus_bool_t +_dbus_watch_get_enabled (DBusWatch *watch) +{ + return watch->enabled; +} + /** * Creates a new DBusWatch. Used to add a file descriptor to be polled * by a main loop. -- cgit