[systemd-commits] src/install.c src/systemctl.c

Michal Schmidt michich at kemper.freedesktop.org
Mon Dec 5 13:37:26 PST 2011


 src/install.c   |    5 ++---
 src/systemctl.c |    5 +++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit d380a3bcd14376ed72286e78dbcc871b7d6d2151
Author: Bill Nottingham <notting at redhat.com>
Date:   Tue Nov 22 15:45:34 2011 -0500

    Allow 'list-unit-files' to run with --root.
    
    To do so, move the check for the bus to the bus-using portion of
    list_unit_files(), and ensure that get_config_path doesn't abort when
    checking the runtime path with --root.

diff --git a/src/install.c b/src/install.c
index cfbd50e..1fb1f9d 100644
--- a/src/install.c
+++ b/src/install.c
@@ -72,9 +72,8 @@ static int get_config_path(UnitFileScope scope, bool runtime, const char *root_d
         case UNIT_FILE_SYSTEM:
 
                 if (root_dir && runtime)
-                        return -EINVAL;
-
-                if (runtime)
+                        asprintf(&p, "%s/run/systemd/system", root_dir);
+                else if (runtime)
                         p = strdup("/run/systemd/system");
                 else if (root_dir)
                         asprintf(&p, "%s/%s", root_dir, SYSTEM_CONFIG_UNIT_PATH);
diff --git a/src/systemctl.c b/src/systemctl.c
index 7373e64..b940c9c 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -622,8 +622,6 @@ static int list_unit_files(DBusConnection *bus, char **args) {
 
         dbus_error_init(&error);
 
-        assert(bus);
-
         pager_open_if_enabled();
 
         if (avoid_bus()) {
@@ -659,6 +657,8 @@ static int list_unit_files(DBusConnection *bus, char **args) {
 
                 hashmap_free(h);
         } else {
+                assert(bus);
+
                 m = dbus_message_new_method_call(
                                 "org.freedesktop.systemd1",
                                 "/org/freedesktop/systemd1",
@@ -5001,6 +5001,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
         if (!streq(verbs[i].verb, "enable") &&
             !streq(verbs[i].verb, "disable") &&
             !streq(verbs[i].verb, "is-enable") &&
+            !streq(verbs[i].verb, "list-unit-files") &&
             !streq(verbs[i].verb, "reenable") &&
             !streq(verbs[i].verb, "preset") &&
             !streq(verbs[i].verb, "mask") &&



More information about the systemd-commits mailing list