diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-07-04 12:19:32 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-07-04 12:23:39 +0200 |
commit | a0c8526a7376a7ef9692a3db6700e574fc714e7c (patch) | |
tree | e8e922531b959f597be295cef5e93ea4a7bece8b /src/core/dbus.c | |
parent | 0a069ce62de904ae9cbaf23d026ac380b02e50e4 (diff) |
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.
Diffstat (limited to 'src/core/dbus.c')
-rw-r--r-- | src/core/dbus.c | 20 |
1 files 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; } |