[v2,2/2] btrfs-progs: limit minimal num of args for btrfs-image
diff mbox

Message ID 1404100452-8894-2-git-send-email-guihc.fnst@cn.fujitsu.com
State Accepted
Headers show

Commit Message

Gui Hecheng June 30, 2014, 3:54 a.m. UTC
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>
---
changelog
	v1->v2: use check_argc_min instead
---
 btrfs-image.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch
diff mbox

diff --git a/btrfs-image.c b/btrfs-image.c
index e0aabfd..3b27155 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2521,6 +2521,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) {