if (asprintf(&n, ":1.%llu", (unsigned long long) name->owner_id) < 0)
return -ENOMEM;
- r = strv_push(x, n);
- if (r < 0) {
- free(n);
- return -ENOMEM;
- }
+ r = strv_consume(x, n);
+ if (r < 0)
+ return r;
previous_id = name->owner_id;
}
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",
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_add_match_internal(
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",
NULL,
NULL,
"s",
- match);
+ e);
}
int bus_remove_match_internal(
r = sd_bus_message_new_method_call(
bus,
+ &m,
name,
"/",
"org.freedesktop.DBus.Peer",
- "GetMachineId", &m);
+ "GetMachineId");
if (r < 0)
return r;