summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGui Hecheng <guihc.fnst@cn.fujitsu.com>2014-06-30 11:54:12 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:55:27 +0200
commit3f6c8a16104591474ee2432467f2c1f6dba6a651 (patch)
tree11b080ee3c8bb96d1a67688fb5b7bb0c218d7d9c
parenta184abc70f7b1468e6036ab576f1587ee0574668 (diff)
btrfs-progs: limit minimal num of args for btrfs-image
The btrfs-image requires at least 2 args to run, one for the source dev/file, the other for the target dev/file. This patch depends on patch: btrfs-progs: move the check_argc_* functions into utils.c Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--btrfs-image.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 03cf85e7..985aa26c 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2522,6 +2522,10 @@ int main(int argc, char *argv[])
}
argc = argc - optind;
+ set_argv0(argv);
+ if (check_argc_min(argc, 2))
+ print_usage();
+
dev_cnt = argc - 1;
if (create) {