[PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The btrfs-image requires at least 2 args to run,
one for the source dev/file, the other for the target dev/file.

Signed-off-by: Gui Hecheng <guihc.fnst@xxxxxxxxxxxxxx>
---
 btrfs-image.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/btrfs-image.c b/btrfs-image.c
index e0aabfd..b13f236 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2521,6 +2521,9 @@ int main(int argc, char *argv[])
 	}
 
 	argc = argc - optind;
+	if (argc < 2)
+		print_usage();
+
 	dev_cnt = argc - 1;
 
 	if (create) {
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux