]> err.no Git - util-linux/commitdiff
fallocate: check for number of arguments
authorKarel Zak <kzak@redhat.com>
Fri, 14 May 2010 11:04:50 +0000 (13:04 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 14 May 2010 11:04:50 +0000 (13:04 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/fallocate.c

index e41643a2ffc7d947eae410398c22f6d79030990f..d1f43c24253da968af6610979d04cc5f440b4352 100644 (file)
@@ -122,6 +122,11 @@ int main(int argc, char **argv)
 
        fname = argv[optind++];
 
+       if (optind != argc) {
+               warnx(_("unexpected number of arguments"));
+               usage(stderr);
+       }
+
        fd = open(fname, O_WRONLY|O_CREAT, 0644);
        if (fd < 0)
                err(EXIT_FAILURE, _("%s: open failed"), fname);