summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2015-10-18 12:15:10 +0200
committerDavid Herrmann <dh.herrmann@googlemail.com>2015-10-18 12:15:10 +0200
commit606601ddcac15f5ade4f6840fd04d6f26acce2f4 (patch)
treeda1d097a72e2479070d86fa652c03c3d36ff5ff7 /src/core
parenteacb22c21b31bba5d0387982c6b0b4faa452cb5e (diff)
parent9806e87da22d0025d7c427907202e5751a6b5989 (diff)
Merge pull request #1595 from poettering/proxy-fixes
bus proxy fixes, and more
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus.c2
-rw-r--r--src/core/unit.c19
-rw-r--r--src/core/unit.h2
3 files changed, 10 insertions, 13 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 2d6a1ff836..d8891d49d8 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -777,7 +777,7 @@ static int bus_setup_api(Manager *m, sd_bus *bus) {
return r;
HASHMAP_FOREACH_KEY(u, name, m->watch_bus, i) {
- r = unit_install_bus_match(bus, u, name);
+ r = unit_install_bus_match(u, bus, name);
if (r < 0)
log_error_errno(r, "Failed to subscribe to NameOwnerChanged signal: %m");
}
diff --git a/src/core/unit.c b/src/core/unit.c
index 39cd89f1e3..d8f0eb8111 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2508,26 +2508,23 @@ static int signal_name_owner_changed(sd_bus_message *message, void *userdata, sd
return 0;
}
-int unit_install_bus_match(sd_bus *bus, Unit *u, const char *name) {
- _cleanup_free_ char *match = NULL;
- Manager *m = u->manager;
+int unit_install_bus_match(Unit *u, sd_bus *bus, const char *name) {
+ const char *match;
- assert(m);
+ assert(u);
+ assert(bus);
+ assert(name);
if (u->match_bus_slot)
return -EBUSY;
- match = strjoin("type='signal',"
+ match = strjoina("type='signal',"
"sender='org.freedesktop.DBus',"
"path='/org/freedesktop/DBus',"
"interface='org.freedesktop.DBus',"
"member='NameOwnerChanged',"
- "arg0='",
- name,
- "'",
+ "arg0='", name, "'",
NULL);
- if (!match)
- return -ENOMEM;
return sd_bus_add_match(bus, &u->match_bus_slot, match, signal_name_owner_changed, u);
}
@@ -2544,7 +2541,7 @@ int unit_watch_bus_name(Unit *u, const char *name) {
if (u->manager->api_bus) {
/* If the bus is already available, install the match directly.
* Otherwise, just put the name in the list. bus_setup_api() will take care later. */
- r = unit_install_bus_match(u->manager->api_bus, u, name);
+ r = unit_install_bus_match(u, u->manager->api_bus, name);
if (r < 0)
return log_warning_errno(r, "Failed to subscribe to NameOwnerChanged signal: %m");
}
diff --git a/src/core/unit.h b/src/core/unit.h
index a4a1b011fc..9f8518c720 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -520,7 +520,7 @@ void unit_unwatch_all_pids(Unit *u);
void unit_tidy_watch_pids(Unit *u, pid_t except1, pid_t except2);
-int unit_install_bus_match(sd_bus *bus, Unit *u, const char *name);
+int unit_install_bus_match(Unit *u, sd_bus *bus, const char *name);
int unit_watch_bus_name(Unit *u, const char *name);
void unit_unwatch_bus_name(Unit *u, const char *name);