linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: <linux-btrfs@vger.kernel.org>, Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Subject: [PATCH v2 2/2] btrfs-progs: limit minimal num of args for btrfs-image
Date: Mon, 30 Jun 2014 11:54:12 +0800	[thread overview]
Message-ID: <1404100452-8894-2-git-send-email-guihc.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1404100452-8894-1-git-send-email-guihc.fnst@cn.fujitsu.com>

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(+)

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) {
-- 
1.8.1.4


  reply	other threads:[~2014-06-30  3:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26  2:53 [PATCH 1/6] btrfs-progs: fix btrfs-image old_restore fsck failure Gui Hecheng
2014-06-26  2:53 ` [PATCH 2/6] btrfs-progs: deal with malloc failure in btrfs-image Gui Hecheng
2014-06-26  2:53 ` [PATCH 3/6] btrfs-progs: cleanup unnecessary free if malloc fails " Gui Hecheng
2014-06-26  2:53 ` [PATCH 4/6] btrfs-progs: cleanup possible silent failure " Gui Hecheng
2014-06-26  2:53 ` [PATCH 5/6] btrfs-progs: limit minimal num of args for btrfs-image Gui Hecheng
2014-06-27 12:35   ` David Sterba
2014-06-30  1:47     ` Gui Hecheng
2014-06-30  3:54     ` [PATCH 1/2] btrfs-progs: move the check_argc_* functions into utils.c Gui Hecheng
2014-06-30  3:54       ` Gui Hecheng [this message]
2014-07-01 23:11       ` David Sterba
2014-07-02  0:20         ` WorMzy Tykashi
2014-07-02  9:34           ` David Sterba
2014-07-02 10:50             ` WorMzy Tykashi
2014-07-02  1:13         ` Gui Hecheng
2014-07-10  1:06         ` [PATCH] btrfs-progs: use check_argc_* to check arg number for all tools Gui Hecheng
2014-07-16  3:44           ` [PATCH v2] " Gui Hecheng
2014-07-16  3:58             ` Gui Hecheng
2014-07-16  3:59           ` Gui Hecheng
2014-06-26  2:53 ` [PATCH 6/6] btrfs-progs: use BTRFS_SUPER_INFO_SIZE to replace raw 4096 in btrfs-image Gui Hecheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404100452-8894-2-git-send-email-guihc.fnst@cn.fujitsu.com \
    --to=guihc.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).