]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: do not accept any non-option arguments
authorRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 20 Jun 2017 09:50:20 +0000 (11:50 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 22 Jun 2017 19:34:43 +0000 (21:34 +0200)
'dmesg foo' is no valid syntax and gives an error now.
BTW we avoid the "dead increment of argc and argv.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
sys-utils/dmesg.c

index b83cfb1bb5bf3285508cba36e04f6450c102c9aa..5be4ff6087ab055cefa5ad17f293bc555f5da66d 100644 (file)
@@ -1486,10 +1486,8 @@ int main(int argc, char *argv[])
                        errtryhelp(EXIT_FAILURE);
                }
        }
-       argc -= optind;
-       argv += optind;
 
-       if (argc > 1)
+       if (argc != optind)
                usage(stderr);
 
        if ((is_timefmt(&ctl, RELTIME) ||