summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-18 20:31:21 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-18 20:58:39 -0400
commit4654e558a3c297a71f05c3b2db6a2744fcf3cdea (patch)
tree5d99930b723aa2fa568cb6e117dce4106b39a57c /src/login/logind-dbus.c
parentce0fc5f5f6debc6e37ac3ab0a3ea1c9c35b3ed99 (diff)
logind: exploit previous cleanups and simplify returns
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index ed2ce97156..4ae8362211 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -901,7 +901,7 @@ finish:
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
struct udev_device *d;
- char *rule = NULL, *file = NULL;
+ char _cleanup_free_ *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
@@ -943,9 +943,6 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
r = trigger_device(m, d);
finish:
- free(rule);
- free(file);
-
if (d)
udev_device_unref(d);
@@ -953,7 +950,7 @@ finish:
}
static int flush_devices(Manager *m) {
- DIR *d;
+ DIR _cleanup_closedir_ *d;
assert(m);
@@ -978,8 +975,6 @@ static int flush_devices(Manager *m) {
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
log_warning("Failed to unlink %s: %m", de->d_name);
}
-
- closedir(d);
}
return trigger_device(m, NULL);
@@ -1222,9 +1217,8 @@ finish:
reply,
DBUS_TYPE_STRING, &result,
DBUS_TYPE_INVALID);
- if (!b) {
+ if (!b)
return -ENOMEM;
- }
*_reply = reply;
reply = NULL;
@@ -2406,21 +2400,19 @@ DBusHandlerResult bus_message_filter(
int manager_send_changed(Manager *manager, const char *properties) {
_cleanup_dbus_message_unref_ DBusMessage *m = NULL;
- int r = -ENOMEM;
assert(manager);
- m = bus_properties_changed_new("/org/freedesktop/login1", "org.freedesktop.login1.Manager", properties);
+ m = bus_properties_changed_new("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ properties);
if (!m)
- goto finish;
+ return -ENOMEM;
if (!dbus_connection_send(manager->bus, m, NULL))
- goto finish;
-
- r = 0;
+ return -ENOMEM;
-finish:
- return r;
+ return 0;
}
int manager_dispatch_delayed(Manager *manager) {