]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut-install): do not fail when SOURCE is optional and missing
authorPavel Valena <pvalena@redhat.com>
Fri, 25 Mar 2022 15:20:16 +0000 (16:20 +0100)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 4 Apr 2022 08:00:10 +0000 (08:00 +0000)
When running dracut-install with '-o' (optional source), and nullglob
at the same time, when all of the arguments evaluate <null>, dracut-install
should not fail even when the source is not specified.

src/install/dracut-install.c

index 9a53be158d816b5a5d98f385c0a86d277d3b1ed5..d7a1cd9b6367c342d426fb2a04ed8530d746c09d 100644 (file)
@@ -1175,8 +1175,12 @@ static int parse_argv(int argc, char *argv[])
         }
 
         if (!optind || optind == argc) {
-                log_error("No SOURCE argument given");
-                usage(EXIT_FAILURE);
+                if (!arg_optional) {
+                        log_error("No SOURCE argument given");
+                        usage(EXIT_FAILURE);
+                } else {
+                        exit(EXIT_SUCCESS);
+                }
         }
 
         return 1;