]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fix a bug where switch_root would erroneously try to parse initargs
authorPaul Asmuth <paul@asmuth.com>
Fri, 9 Nov 2018 16:02:11 +0000 (17:02 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 4 Jan 2019 10:15:01 +0000 (11:15 +0100)
before this change, switch_root would try to parse all arguments,
including 'initargs', using getopt, which would lead to an 'unrecognized
option' error when trying to pass a flag to the init program

sys-utils/switch_root.c

index 3c66d01867a005dbe88bbcbc154b009c561acbd2..a85ce24b9338abc01b0ebddf165d19464cb6bc57 100644 (file)
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
 
        atexit(close_stdout);
 
 
        atexit(close_stdout);
 
-       while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
+       while ((c = getopt_long(argc, argv, "+Vh", longopts, NULL)) != -1)
                switch (c) {
                case 'V':
                        printf(UTIL_LINUX_VERSION);
                switch (c) {
                case 'V':
                        printf(UTIL_LINUX_VERSION);