All of lore.kernel.org
 help / color / mirror / Atom feed
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH 5/5] btrfs-progs: btrfs-crc: make argc check more strict
Date: Thu, 2 Jun 2016 17:14:57 +0900	[thread overview]
Message-ID: <9919499d-5ffe-e7b2-1e08-922f33edeb23@jp.fujitsu.com> (raw)
In-Reply-To: <08faf8d3-0cc4-5164-b583-f69c8c3eb5bc@jp.fujitsu.com>

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
  btrfs-crc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/btrfs-crc.c b/btrfs-crc.c
index c2b5f00..d433ff3 100644
--- a/btrfs-crc.c
+++ b/btrfs-crc.c
@@ -69,12 +69,14 @@ int main(int argc, char **argv)
  	str = argv[optind];

  	if (!loop) {
-		if (check_argc_min(argc - optind, 1))
+		if (check_argc_exact(argc - optind, 1))
  			print_usage(255);

  		printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str);
  		return 0;
  	}
+	if (check_argc_exact(argc - optind, 0))
+		print_usage(255);

  	buf = malloc(length);
  	if (!buf)
-- 
2.5.5

  parent reply	other threads:[~2016-06-02  8:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  8:06 [PATCH 1/5] btrfs-progs: btrfs-crc: fix build error Satoru Takeuchi
2016-06-02  8:10 ` [PATCH 2/5] btrfs-progs: btrfs-crc should be ignored by git Satoru Takeuchi
2016-06-02  8:11 ` [PATCH 3/5] btrfs-progs: btrfs-crc: print usage on receiving invalid arguments Satoru Takeuchi
2016-06-02  8:13 ` [PATCH 4/5] btrfs-progs: btrfs-crc: improve usage message Satoru Takeuchi
2016-06-02  8:14 ` Satoru Takeuchi [this message]
2016-06-03 13:21 ` [PATCH 1/5] btrfs-progs: btrfs-crc: fix build error David Sterba

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=9919499d-5ffe-e7b2-1e08-922f33edeb23@jp.fujitsu.com \
    --to=takeuchi_satoru@jp.fujitsu.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.