summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-03-11 16:32:47 +0100
committerSangjung Woo <sangjung.woo@samsung.com>2015-12-24 09:29:41 +0900
commitf5c419a47ec99a82a1b3a7f9909dac95d30e1da0 (patch)
tree0203a351e766bdcbb161468ef7be2ef4b2f0ebf6
parentaab937df30efd612bc6087894e339ee785a10f23 (diff)
downloadsystemd-f5c419a47ec99a82a1b3a7f9909dac95d30e1da0.tar.gz
systemd-f5c419a47ec99a82a1b3a7f9909dac95d30e1da0.tar.bz2
systemd-f5c419a47ec99a82a1b3a7f9909dac95d30e1da0.zip
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. origin: https://github.com/systemd/systemd/commit/39881ed299a39ad33 Change-Id: I3611a9390a66e0d23da48df497058ecb82da5d15 Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
-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 260775cd85..47e316e7bf 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -89,15 +89,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;
}