]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: stricter command line parsing
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Thu, 15 Sep 2011 06:52:34 +0000 (08:52 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 27 Sep 2011 12:48:33 +0000 (14:48 +0200)
Disallow superfluous commands for lscpu like e.g. "lscpu bla" and let it
fail print the help text instead.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
sys-utils/lscpu.c

index c636eb7cbfb34d99f41fb323b3d8b2b4b27f7ab6..8637ef1949c555ef3287cb2f939c87591f09435c 100644 (file)
@@ -1289,6 +1289,10 @@ int main(int argc, char *argv[])
                        usage(stderr);
                }
        }
+
+       if (argc != optind)
+               usage(stderr);
+
        /* set default cpu display mode if none was specified */
        if (!mod->online && !mod->offline) {
                mod->online = 1;