diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-03-11 16:32:47 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-03-11 16:36:41 +0100 |
commit | 39881ed299a39ad331262c75d9e627e6ffb848eb (patch) | |
tree | cf6faab7a7bf4e4f1817be506b42463afc5fd13a | |
parent | 908b8a42e645887f1ab0616c1fc018ecc8ece91f (diff) |
core: rewind message before forwarding it
Forwarding messages that are not rewinded will drop data. Fix this for
cgroups-agent messages that we might remarshal before forwarding to the
system bus.
-rw-r--r-- | src/core/dbus.c | 18 |
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; } |