summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-19 21:37:32 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-20 20:58:16 +0100
commitb51f299ae17ebdedecf8f38d98cb94cfee763fa7 (patch)
treead593911a0683216c57960af8fda3012210e8821
parentf8cfb5f5f341e35bb8c8fc76680a95941cdef927 (diff)
busctl: when no match is specified, add default match
-rw-r--r--src/libsystemd-bus/busctl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libsystemd-bus/busctl.c b/src/libsystemd-bus/busctl.c
index b9b3305e93..4204adb5bc 100644
--- a/src/libsystemd-bus/busctl.c
+++ b/src/libsystemd-bus/busctl.c
@@ -129,6 +129,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
}
static int monitor(sd_bus *bus, char *argv[]) {
+ bool added_something = false;
char **i;
int r;
@@ -149,6 +150,8 @@ static int monitor(sd_bus *bus, char *argv[]) {
log_error("Failed to add match: %s", strerror(-r));
return r;
}
+
+ added_something = true;
}
STRV_FOREACH(i, arg_matches) {
@@ -157,6 +160,16 @@ static int monitor(sd_bus *bus, char *argv[]) {
log_error("Failed to add match: %s", strerror(-r));
return r;
}
+
+ added_something = true;
+ }
+
+ if (!added_something) {
+ r = sd_bus_add_match(bus, "", NULL, NULL);
+ if (r < 0) {
+ log_error("Failed to add match: %s", strerror(-r));
+ return r;
+ }
}
for (;;) {