summaryrefslogtreecommitdiff
path: root/src/bus-driverd/bus-driverd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-19 21:14:52 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-19 22:18:39 +0100
commit37224a5ff522a366b353e8a01e2c2eee1e5416e5 (patch)
tree9da1d82af8aa34acc360e889b05b436e6ebb76f7 /src/bus-driverd/bus-driverd.c
parentff2ea19264b016bd34232cd9c4820c9547413a9a (diff)
bus: fix exit-on-idle for driverd
Diffstat (limited to 'src/bus-driverd/bus-driverd.c')
-rw-r--r--src/bus-driverd/bus-driverd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/bus-driverd/bus-driverd.c b/src/bus-driverd/bus-driverd.c
index d4126a99b6..46ee3492ba 100644
--- a/src/bus-driverd/bus-driverd.c
+++ b/src/bus-driverd/bus-driverd.c
@@ -772,6 +772,13 @@ static int connect_bus(Context *c) {
return 0;
}
+static bool check_idle(void *userdata) {
+ Context *c = userdata;
+ assert(c);
+
+ return hashmap_isempty(c->clients);
+}
+
int main(int argc, char *argv[]) {
Context context = {};
Client *c;
@@ -799,7 +806,7 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
- r = bus_event_loop_with_idle(context.event, context.bus, "org.freedesktop.DBus", DEFAULT_EXIT_USEC);
+ r = bus_event_loop_with_idle(context.event, context.bus, "org.freedesktop.DBus", DEFAULT_EXIT_USEC, check_idle, &context);
if (r < 0) {
log_error("Failed to run event loop: %s", strerror(-r));
goto finish;