systemctl: check existence of all units, not just the first one
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 2 Sep 2017 14:37:08 +0000 (17:37 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 3 Sep 2017 14:49:02 +0000 (17:49 +0300)
src/systemctl/systemctl.c

index 36675dc..398c601 100644 (file)
@@ -6201,11 +6201,15 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
                 sd_bus *bus;
 
                 if (STR_IN_SET(verb, "mask", "unmask")) {
-                        r = unit_exists(*names);
-                        if (r < 0)
-                                return r;
-                        if (r == 0)
-                                log_notice("Unit %s does not exist, proceeding anyway.", *names);
+                        char **name;
+
+                        STRV_FOREACH(name, names) {
+                                r = unit_exists(*name);
+                                if (r < 0)
+                                        return r;
+                                if (r == 0)
+                                        log_notice("Unit %s does not exist, proceeding anyway.", *names);
+                        }
                 }
 
                 r = acquire_bus(BUS_MANAGER, &bus);