summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-21 01:02:23 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-21 01:02:23 +0100
commit85a0aa17dd870703677118726ac448ef08e8defb (patch)
tree2e4b42b8dcb1ba4b875f00a2e0a1d4141e831f5f /src/libsystemd-bus/bus-control.c
parentd86f9d5285742e959a158e743799506b5339fefc (diff)
bus: when watching bus names, we always need to add a change match
Since for the kernel change of ownership of a name between starter and real client is a change and for userspace thats addition/removal, we need to unconditionally subscribe to these change events.
Diffstat (limited to 'src/libsystemd-bus/bus-control.c')
-rw-r--r--src/libsystemd-bus/bus-control.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index 333968aee4..bbee1b5b13 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -820,17 +820,16 @@ static int add_name_change_match(sd_bus *bus,
return -errno;
}
- /* If the neither name is explicitly set to
- * the empty string, then this can match
- * against changed names */
- if (!(old_owner && old_owner[0] == 0) &&
- !(new_owner && new_owner[0] == 0)) {
- item->type = KDBUS_ITEM_NAME_CHANGE;
-
- r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
- if (r < 0)
- return -errno;
- }
+ /* The CHANGE match we need in either case, because
+ * what is reported as a name change by the kernel
+ * might just be an owner change between starter and
+ * normal clients. For userspace such a change should
+ * be considered a removal/addition, hence let's
+ * subscribe to this unconditionally. */
+ item->type = KDBUS_ITEM_NAME_CHANGE;
+ r = ioctl(bus->input_fd, KDBUS_CMD_MATCH_ADD, m);
+ if (r < 0)
+ return -errno;
}
if (is_name_id != 0) {