summaryrefslogtreecommitdiff
path: root/src/dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-03 01:45:14 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-03 01:45:53 +0200
commit53c6a358a8bb9e722ac6b8ba750acf576a61bf27 (patch)
tree8d99b97c82db9a5857eab87b8fb1634d67022eb0 /src/dbus.c
parentb401e1fb9df7ea8b0fd26e16d886056a5ae7c5d9 (diff)
dbus: don't send cgroup agent messages directly to system bus to avoid dbus activation loop
Diffstat (limited to 'src/dbus.c')
-rw-r--r--src/dbus.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/dbus.c b/src/dbus.c
index 8c969eab63..85284324b3 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -464,7 +464,9 @@ static DBusHandlerResult system_bus_message_filter(DBusConnection *connection, D
log_debug("System D-Bus connection terminated.");
bus_done_system(m);
- } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
+ } else if (m->running_as != MANAGER_SYSTEM &&
+ dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
+
const char *cgroup;
if (!dbus_message_get_args(message, &error,
@@ -498,7 +500,9 @@ static DBusHandlerResult private_bus_message_filter(DBusConnection *connection,
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected"))
shutdown_connection(m, connection);
- else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
+ else if (m->running_as == MANAGER_SYSTEM &&
+ dbus_message_is_signal(message, "org.freedesktop.systemd1.Agent", "Released")) {
+
const char *cgroup;
if (!dbus_message_get_args(message, &error,
@@ -507,6 +511,12 @@ static DBusHandlerResult private_bus_message_filter(DBusConnection *connection,
log_error("Failed to parse Released message: %s", error.message);
else
cgroup_notify_empty(m, cgroup);
+
+ /* Forward the message to the system bus, so that user
+ * instances are notified as well */
+
+ if (m->system_bus)
+ dbus_connection_send(m->system_bus, message, NULL);
}
dbus_error_free(&error);
@@ -808,17 +818,19 @@ static int bus_init_system(Manager *m) {
goto fail;
}
- dbus_bus_add_match(m->system_bus,
- "type='signal',"
- "interface='org.freedesktop.systemd1.Agent',"
- "member='Released',"
- "path='/org/freedesktop/systemd1/agent'",
- &error);
-
- if (dbus_error_is_set(&error)) {
- log_error("Failed to register match: %s", error.message);
- r = -EIO;
- goto fail;
+ if (m->running_as != MANAGER_SYSTEM) {
+ dbus_bus_add_match(m->system_bus,
+ "type='signal',"
+ "interface='org.freedesktop.systemd1.Agent',"
+ "member='Released',"
+ "path='/org/freedesktop/systemd1/agent'",
+ &error);
+
+ if (dbus_error_is_set(&error)) {
+ log_error("Failed to register match: %s", error.message);
+ r = -EIO;
+ goto fail;
+ }
}
if (m->api_bus != m->system_bus) {