summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/bus-track.c
diff options
context:
space:
mode:
authorNathaniel McCallum <npmccallum@redhat.com>2018-01-22 16:26:44 -0500
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:50:14 +0200
commit8b42f5e6cdc1c819741ef9492b7cec23971ccc4c (patch)
treee3596c5b52899b308cecfea1f945c5a2219a2bbe /src/libelogind/sd-bus/bus-track.c
parent269ddd6aecc9307853384bfc44a22c9ade596f34 (diff)
Add support for SD_BUS_DEFAULT*
Currently, sd-bus supports the ability to have thread-local default busses. However, this is less useful than it can be since all functions which require an sd_bus* as input require the caller to pass it. This patch adds a new macro which allows the developer to pass a constant SD_BUS_DEFAULT, SD_BUS_DEFAULT_USER or SD_BUS_DEFAULT_SYSTEM instead. This reduces work for the caller. For example: r = sd_bus_default(&bus); r = sd_bus_call_method(bus, ...); sd_bus_unref(bus); Becomes: r = sd_bus_call_method(SD_BUS_DEFAULT, ...); If the specified thread-local default bus does not exist, the function calls will return -ENOPKG. No bus will ever be implicitly created.
Diffstat (limited to 'src/libelogind/sd-bus/bus-track.c')
-rw-r--r--src/libelogind/sd-bus/bus-track.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libelogind/sd-bus/bus-track.c b/src/libelogind/sd-bus/bus-track.c
index 0dd06e9b9..5482d39a0 100644
--- a/src/libelogind/sd-bus/bus-track.c
+++ b/src/libelogind/sd-bus/bus-track.c
@@ -136,6 +136,7 @@ _public_ int sd_bus_track_new(
sd_bus_track *t;
assert_return(bus, -EINVAL);
+ assert_return(bus = bus_resolve(bus), -ENOPKG);
assert_return(track, -EINVAL);
if (!bus->bus_client)