mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-09-03 21:45:02 +03:00
busctl: when no match is specified, add default match
This commit is contained in:
@@ -129,6 +129,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int monitor(sd_bus *bus, char *argv[]) {
|
static int monitor(sd_bus *bus, char *argv[]) {
|
||||||
|
bool added_something = false;
|
||||||
char **i;
|
char **i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@@ -149,6 +150,8 @@ static int monitor(sd_bus *bus, char *argv[]) {
|
|||||||
log_error("Failed to add match: %s", strerror(-r));
|
log_error("Failed to add match: %s", strerror(-r));
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
added_something = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRV_FOREACH(i, arg_matches) {
|
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));
|
log_error("Failed to add match: %s", strerror(-r));
|
||||||
return 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 (;;) {
|
for (;;) {
|
||||||
|
Reference in New Issue
Block a user