diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-01-10 22:45:45 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-01-10 23:03:48 +0100 |
commit | 5dd9014faf58bf974352043fbddd3a8e9c3cd9d9 (patch) | |
tree | 3f884ee7658732e66ee47ab1ed13a15f36218879 /src/core/dbus-snapshot.c | |
parent | d354315ff7a4e128aea58583a3cbedbf86e69196 (diff) |
dbus: duplicate Job.Cancel() as CancelJob() and Snapshot.Remove() as RemoveSnapshot() on the Manager interface
For all other object mehtods there are already counterparts on the
manager object, as they help us reduce round-trips. So let's complete
this, and reduce complexity on the client side a bit.
As a side effect this also makes "systemctl snapshot" without arguments
work again.
Diffstat (limited to 'src/core/dbus-snapshot.c')
-rw-r--r-- | src/core/dbus-snapshot.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/core/dbus-snapshot.c b/src/core/dbus-snapshot.c index 435c6df39c..02cfcb1829 100644 --- a/src/core/dbus-snapshot.c +++ b/src/core/dbus-snapshot.c @@ -54,19 +54,16 @@ static const BusProperty bus_snapshot_properties[] = { DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) { Snapshot *s = SNAPSHOT(u); _cleanup_dbus_message_unref_ DBusMessage *reply = NULL; - DBusError error; - - dbus_error_init(&error); if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Snapshot", "Remove")) { SELINUX_UNIT_ACCESS_CHECK(u, c, message, "stop"); - snapshot_remove(SNAPSHOT(u)); - reply = dbus_message_new_method_return(message); if (!reply) - goto oom; + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + snapshot_remove(SNAPSHOT(u)); } else { const BusBoundProperties bps[] = { @@ -80,15 +77,8 @@ DBusHandlerResult bus_snapshot_message_handler(Unit *u, DBusConnection *c, DBusM return bus_default_message_handler(c, message, INTROSPECTION, INTERFACES_LIST, bps); } - if (reply) { - if (!dbus_connection_send(c, reply, NULL)) - goto oom; - } + if (!dbus_connection_send(c, reply, NULL)) + return DBUS_HANDLER_RESULT_NEED_MEMORY; return DBUS_HANDLER_RESULT_HANDLED; - -oom: - dbus_error_free(&error); - - return DBUS_HANDLER_RESULT_NEED_MEMORY; } |