summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-connection.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-02-16 07:20:54 +0000
committerHavoc Pennington <hp@redhat.com>2003-02-16 07:20:54 +0000
commit4a8a03aeb7430a570618ffec08616c4c87c4ee73 (patch)
treea3ae8240f121e1bfe5bf5df08890ae933f5489d7 /dbus/dbus-connection.c
parent30265b80acc505602e38d19c7d3036c19ee39340 (diff)
2003-02-16 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c (dbus_connection_set_change_sigpipe): allow people to avoid setting SIGPIPE to SIG_IGN (_dbus_connection_new_for_transport): disable SIGPIPE unless we've been asked not to
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r--dbus/dbus-connection.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 73b9f18e..f97a5e13 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -64,6 +64,8 @@
/** default timeout value when waiting for a message reply */
#define DEFAULT_TIMEOUT_VALUE (15 * 1000)
+static dbus_bool_t _dbus_modify_sigpipe = TRUE;
+
/** Opaque typedef for DBusDataSlot */
typedef struct DBusDataSlot DBusDataSlot;
/** DBusDataSlot is used to store application data on the connection */
@@ -480,6 +482,9 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
disconnect_link = _dbus_list_alloc_link (disconnect_message);
if (disconnect_link == NULL)
goto error;
+
+ if (_dbus_modify_sigpipe)
+ _dbus_disable_sigpipe ();
connection->refcount = 1;
connection->mutex = mutex;
@@ -1684,7 +1689,9 @@ _dbus_allocated_slots_init_lock (void)
* Allocates an integer ID to be used for storing application-specific
* data on any DBusConnection. The allocated ID may then be used
* with dbus_connection_set_data() and dbus_connection_get_data().
- * If allocation fails, -1 is returned.
+ * If allocation fails, -1 is returned. Again, the allocated
+ * slot is global, i.e. all DBusConnection objects will
+ * have a slot with the given integer ID reserved.
*
* @returns -1 on failure, otherwise the data slot ID
*/
@@ -1865,6 +1872,18 @@ dbus_connection_get_data (DBusConnection *connection,
return res;
}
+/**
+ * This function sets a global flag for whether dbus_connection_new()
+ * will set SIGPIPE behavior to SIG_IGN.
+ *
+ * @param will_modify_sigpipe #TRUE to allow sigpipe to be set to SIG_IGN
+ */
+void
+dbus_connection_set_change_sigpipe (dbus_bool_t will_modify_sigpipe)
+{
+ _dbus_modify_sigpipe = will_modify_sigpipe;
+}
+
/* This must be called with the connection lock not held to avoid
* holding it over the free_data callbacks, so it can basically
* only be called at last unref