systemctl: fix detection whether the dbus connection is available
authorLennart Poettering <lennart@poettering.net>
Thu, 29 Sep 2011 13:31:53 +0000 (15:31 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 29 Sep 2011 13:32:10 +0000 (15:32 +0200)
src/systemctl.c

index 848d6a8..7af0f73 100644 (file)
@@ -4989,6 +4989,13 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
                         return 0;
                 }
 
+                if (!bus) {
+                        log_error("Failed to get D-Bus connection: %s", error->message);
+                        return -EIO;
+                }
+
+        } else {
+
                 if (!bus && !avoid_bus()) {
                         log_error("Failed to get D-Bus connection: %s", error->message);
                         return -EIO;