summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-control.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-11 23:44:00 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-12 00:12:44 +0100
commit8d162091c0512e0c2bb0e7ac22b927f1f5af95b4 (patch)
treeb7e6f00248c4c96efdf8182c152a87708a3f0930 /src/libsystemd-bus/bus-control.c
parenta8a07f892c6f64d88a9848deed56a9f3b778301a (diff)
bus: set no_auto_start flag for GetMachineId calls, so that we don't auto-start if we want to know the machine of a bus service
Diffstat (limited to 'src/libsystemd-bus/bus-control.c')
-rw-r--r--src/libsystemd-bus/bus-control.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c
index 4b43331642..f217269f79 100644
--- a/src/libsystemd-bus/bus-control.c
+++ b/src/libsystemd-bus/bus-control.c
@@ -225,14 +225,10 @@ _public_ int sd_bus_get_owner(sd_bus *bus, const char *name, char **owner) {
const char *found;
int r;
- if (!bus)
- return -EINVAL;
- if (!name)
- return -EINVAL;
- if (!BUS_IS_OPEN(bus->state))
- return -ENOTCONN;
- if (bus_pid_changed(bus))
- return -ECHILD;
+ assert_return(bus, -EINVAL);
+ assert_return(name, -EINVAL);
+ assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
r = sd_bus_call_method(
bus,
@@ -539,31 +535,33 @@ int bus_remove_match_internal(
}
_public_ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machine) {
- _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
+ _cleanup_bus_message_unref_ sd_bus_message *reply = NULL, *m = NULL;
const char *mid;
int r;
- if (!bus)
- return -EINVAL;
- if (!name)
- return -EINVAL;
- if (!BUS_IS_OPEN(bus->state))
- return -ENOTCONN;
- if (bus_pid_changed(bus))
- return -ECHILD;
+ assert_return(bus, -EINVAL);
+ assert_return(name, -EINVAL);
+ assert_return(machine, -EINVAL);
+ assert_return(BUS_IS_OPEN(bus->state), -ENOTCONN);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
if (streq_ptr(name, bus->unique_name))
return sd_id128_get_machine(machine);
- r = sd_bus_call_method(bus,
- name,
- "/",
- "org.freedesktop.DBus.Peer",
- "GetMachineId",
- NULL,
- &reply,
- NULL);
+ r = sd_bus_message_new_method_call(
+ bus,
+ name,
+ "/",
+ "org.freedesktop.DBus.Peer",
+ "GetMachineId", &m);
+ if (r < 0)
+ return r;
+
+ r = sd_bus_message_set_no_auto_start(m, true);
+ if (r < 0)
+ return r;
+ r = sd_bus_call(bus, m, 0, NULL, &reply);
if (r < 0)
return r;