networkd: don't do exit-on-idle if there is something wrong with the dbus connection
authorTom Gundersen <teg@jklm.no>
Wed, 11 Feb 2015 11:57:58 +0000 (12:57 +0100)
committerTom Gundersen <teg@jklm.no>
Wed, 11 Feb 2015 12:13:49 +0000 (13:13 +0100)
Just fall back to plain old event loop in this (highly unlikely) case.

In the glorious future when kdbus is upstream we can of course drop all this.

src/network/networkd-manager.c

index 4617f11..ce97ac0 100644 (file)
@@ -534,13 +534,18 @@ static bool manager_check_idle(void *userdata) {
 int manager_run(Manager *m) {
         assert(m);
 
-        return bus_event_loop_with_idle(
-                        m->event,
-                        m->bus,
-                        "org.freedesktop.network1",
-                        DEFAULT_EXIT_USEC,
-                        manager_check_idle,
-                        m);
+        if (m->bus)
+                return bus_event_loop_with_idle(
+                                m->event,
+                                m->bus,
+                                "org.freedesktop.network1",
+                                DEFAULT_EXIT_USEC,
+                                manager_check_idle,
+                                m);
+        else
+                /* failed to connect to the bus, so we lose exit-on-idle logic,
+                   this should not happen except if dbus is not around at all */
+                return sd_event_loop(m->event);
 }
 
 int manager_load_config(Manager *m) {