summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-07-04 12:19:32 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-07-04 12:23:39 +0200
commita0c8526a7376a7ef9692a3db6700e574fc714e7c (patch)
treee8e922531b959f597be295cef5e93ea4a7bece8b
parent0a069ce62de904ae9cbaf23d026ac380b02e50e4 (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.
-rw-r--r--src/core/dbus.c20
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;
}