summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-sysdeps.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-07-10 21:33:02 -0400
committerColin Walters <walters@verbum.org>2009-07-13 13:07:12 -0400
commit0e36cdd54964c4012acec2bb8e598b85e82d2846 (patch)
tree7e9dd7470edac5ecccdf69bc3c5cb8f3cb425a6e /dbus/dbus-sysdeps.c
parent6b163e95e7a2318a98c16c0d0944337e38e62efa (diff)
Bug 896 - Avoid race conditions reading message from exited process
Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>, thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>, Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> 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.
Diffstat (limited to 'dbus/dbus-sysdeps.c')
-rw-r--r--dbus/dbus-sysdeps.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c
index e0fe8888..ccd80ccd 100644
--- a/dbus/dbus-sysdeps.c
+++ b/dbus/dbus-sysdeps.c
@@ -1078,6 +1078,16 @@ _dbus_get_is_errno_eintr (void)
}
/**
+ * See if errno is EPIPE
+ * @returns #TRUE if errno == EPIPE
+ */
+dbus_bool_t
+_dbus_get_is_errno_epipe (void)
+{
+ return errno == EPIPE;
+}
+
+/**
* Get error message from errno
* @returns _dbus_strerror(errno)
*/