summaryrefslogtreecommitdiffstats
path: root/sys-utils/fallocate.c
diff options
context:
space:
mode:
authorKarel Zak2010-05-14 13:04:50 +0200
committerKarel Zak2010-05-14 13:04:50 +0200
commitfd1ee3b92e08b17a67099371e647da54632b2f8a (patch)
tree28510e94a5b81dea34a43bcdd5ab01fae681be8d /sys-utils/fallocate.c
parentfsfreeze: new command (diff)
downloadkernel-qcow2-util-linux-fd1ee3b92e08b17a67099371e647da54632b2f8a.tar.gz
kernel-qcow2-util-linux-fd1ee3b92e08b17a67099371e647da54632b2f8a.tar.xz
kernel-qcow2-util-linux-fd1ee3b92e08b17a67099371e647da54632b2f8a.zip
fallocate: check for number of arguments
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/fallocate.c')
-rw-r--r--sys-utils/fallocate.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index e41643a2f..d1f43c242 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);