From: Karel Zak Date: Fri, 14 May 2010 11:04:50 +0000 (+0200) Subject: fallocate: check for number of arguments X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd1ee3b92e08b17a67099371e647da54632b2f8a;p=util-linux fallocate: check for number of arguments Signed-off-by: Karel Zak --- diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c index e41643a2..d1f43c24 100644 --- a/sys-utils/fallocate.c +++ b/sys-utils/fallocate.c @@ -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);