summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/dbus.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 80f7589f24..e000cccd11 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -88,15 +88,19 @@ static int signal_agent_released(sd_bus *bus, sd_bus_message *message, void *use
manager_notify_cgroup_empty(m, cgroup);
- if (m->running_as == SYSTEMD_SYSTEM && m->system_bus) {
- /* If we are running as system manager, forward the
- * message to the system bus */
+ /* only forward to system bus if running as system instance */
+ if (m->running_as != SYSTEMD_SYSTEM || !m->system_bus)
+ return 0;
- r = sd_bus_send(m->system_bus, message, NULL);
- if (r < 0)
- log_warning_errno(r, "Failed to forward Released message: %m");
- }
+ r = sd_bus_message_rewind(message, 1);
+ if (r < 0)
+ goto exit;
+
+ r = sd_bus_send(m->system_bus, message, NULL);
+exit:
+ if (r < 0)
+ log_warning_errno(r, "Failed to forward Released message: %m");
return 0;
}