systemctl: don't allow --wait with commands that might not start units
authorAlan Jenkins <alan.christopher.jenkins@gmail.com>
Wed, 16 Aug 2017 17:09:47 +0000 (18:09 +0100)
committerAlan Jenkins <alan.christopher.jenkins@gmail.com>
Fri, 18 Aug 2017 12:46:41 +0000 (13:46 +0100)
There's no good reason to use `--wait` with ReloadOrRestartUnit, or
TryRestartUnit.

The message was also wrong in another sense.  'systemctl isolate'
starts units, but it did not support `--wait`.  Although it's
unlikely anyone would want to do that in the first place.

src/systemctl/systemctl.c

index 36675dc..9b0fe1b 100644 (file)
@@ -3068,8 +3068,8 @@ static int start_unit(int argc, char *argv[], void *userdata) {
         char **name;
         int r = 0;
 
-        if (arg_wait && !strstr(argv[0], "start")) {
-                log_error("--wait may only be used with a command that starts units.");
+        if (arg_wait && !STR_IN_SET(argv[0], "start", "restart")) {
+                log_error("--wait may only be used with the 'start' or 'restart' commands.");
                 return -EINVAL;
         }