summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorSimon Peeters <peeters.simon@gmail.com>2012-08-08 17:20:04 +0200
committerSimon Peeters <peeters.simon@gmail.com>2012-08-08 17:20:04 +0200
commitb9c26b413497a0014ac2058a0ec04849a83df1ea (patch)
treefdf7c8d62be930e2a1c7e1485503e6c12fee77c6 /src/login/logind-dbus.c
parent436dddeda6d212ffe2cc2ced4d84ce475137eddf (diff)
logind: use bus_method_call_with_reply() where posible
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 86ca654518..ae9671bb1e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -968,36 +968,21 @@ static int have_multiple_sessions(
}
static int send_start_unit(DBusConnection *connection, const char *unit_name, DBusError *error) {
- DBusMessage *message, *reply;
const char *mode = "replace";
- assert(connection);
assert(unit_name);
- message = dbus_message_new_method_call(
+ return bus_method_call_with_reply (
+ connection,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
- "StartUnit");
- if (!message)
- return -ENOMEM;
-
- if (!dbus_message_append_args(message,
- DBUS_TYPE_STRING, &unit_name,
- DBUS_TYPE_STRING, &mode,
- DBUS_TYPE_INVALID)) {
- dbus_message_unref(message);
- return -ENOMEM;
- }
-
- reply = dbus_connection_send_with_reply_and_block(connection, message, -1, error);
- dbus_message_unref(message);
-
- if (!reply)
- return -EIO;
-
- dbus_message_unref(reply);
- return 0;
+ "StartUnit",
+ NULL,
+ NULL,
+ DBUS_TYPE_STRING, &unit_name,
+ DBUS_TYPE_STRING, &mode,
+ DBUS_TYPE_INVALID);
}
static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {