summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars@uebernic.de>2015-09-23 00:06:18 +0200
committerLars Uebernickel <lars@uebernic.de>2015-09-23 00:06:18 +0200
commitf6d1e6cbe98307b72fbc02ad8f269f5588681856 (patch)
treea16fc2b911433561167967244d01d6efed33c715
parent3c0fffb74ef7ea572182d9637847e950e9a3a922 (diff)
busctl: also monitor messages to SERVICE arguments
Add a 'destination' match rule for every SERVICE argument in addition to the 'sender' rule. This is consistent with busctl(1), which documents monitor as dumping "messages to or from this peer".
-rw-r--r--src/libsystemd/sd-bus/busctl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 09eba51d1c..5d07d5809c 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -1096,6 +1096,15 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
if (r < 0)
return log_error_errno(r, "Failed to add match: %m");
+ free(m);
+ m = strjoin("destination='", *i, "'", NULL);
+ if (!m)
+ return log_oom();
+
+ r = sd_bus_add_match(bus, NULL, m, NULL, NULL);
+ if (r < 0)
+ return log_error_errno(r, "Failed to add match: %m");
+
added_something = true;
}