summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-11 23:42:30 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-12 00:12:44 +0100
commita8a07f892c6f64d88a9848deed56a9f3b778301a (patch)
tree39814b30c11c8ee5cf1ec68f3498927fc800a11e /src/libsystemd-bus
parent1fee9de5096fe9955b89523aedecf8962ab0e8c5 (diff)
bus: detect blocking message calls to our own connection and return ELOOP early
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/sd-bus.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 3ecda17fce..89437c161c 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1637,6 +1637,19 @@ _public_ int sd_bus_call(
sd_bus_message_unref(incoming);
return -EIO;
+
+ } else if (incoming->header->serial == serial &&
+ bus->unique_name &&
+ incoming->sender &&
+ streq(bus->unique_name, incoming->sender)) {
+
+ /* Our own message? Somebody is trying
+ * to send its own client a message,
+ * let's not dead-lock, let's fail
+ * immediately. */
+
+ sd_bus_message_unref(incoming);
+ return -ELOOP;
}
/* There's already guaranteed to be room for