From a0c8526a7376a7ef9692a3db6700e574fc714e7c Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 4 Jul 2015 12:19:32 +0200 Subject: core: fix coding style in agent-handling Avoid late bail-out based on a condition. This makes code hard to read. Instead, reverse the forwarding-condition. --- src/core/dbus.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/core/dbus.c b/src/core/dbus.c index 6679ebadf1..057653a8b5 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -108,19 +108,15 @@ static int signal_agent_released(sd_bus_message *message, void *userdata, sd_bus manager_notify_cgroup_empty(m, cgroup); - /* only forward to system bus if running as system instance */ - if (m->running_as != MANAGER_SYSTEM || !m->system_bus) - return 0; - - r = sd_bus_message_rewind(message, 1); - if (r < 0) - goto exit; - - r = sd_bus_send(m->system_bus, message, NULL); + /* if running as system-instance, forward under our name */ + if (m->running_as == MANAGER_SYSTEM && m->system_bus) { + r = sd_bus_message_rewind(message, 1); + if (r >= 0) + r = sd_bus_send(m->system_bus, message, NULL); + if (r < 0) + log_warning_errno(r, "Failed to forward Released message: %m"); + } -exit: - if (r < 0) - log_warning_errno(r, "Failed to forward Released message: %m"); return 0; } -- cgit v1.2.3-54-g00ecf