summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd/sd-bus/bus-control.c')
-rw-r--r--src/libsystemd/sd-bus/bus-control.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index db0c11b0fe..bb6683efff 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -1098,13 +1098,22 @@ int bus_add_match_internal_kernel(
return 0;
}
+#define internal_match(bus, m) \
+ ((bus)->hello_flags & KDBUS_HELLO_MONITOR \
+ ? (isempty(m) ? "eavesdrop='true'" : strappenda((m), ",eavesdrop='true'")) \
+ : (m))
+
static int bus_add_match_internal_dbus1(
sd_bus *bus,
const char *match) {
+ const char *e;
+
assert(bus);
assert(match);
+ e = internal_match(bus, match);
+
return sd_bus_call_method(
bus,
"org.freedesktop.DBus",
@@ -1114,7 +1123,7 @@ static int bus_add_match_internal_dbus1(
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_add_match_internal(
@@ -1159,9 +1168,13 @@ static int bus_remove_match_internal_dbus1(
sd_bus *bus,
const char *match) {
+ const char *e;
+
assert(bus);
assert(match);
+ e = internal_match(bus, match);
+
return sd_bus_call_method(
bus,
"org.freedesktop.DBus",
@@ -1171,7 +1184,7 @@ static int bus_remove_match_internal_dbus1(
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_remove_match_internal(