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 3/4] btrfs-progs: Fix a regression that btrfs filesystem label doesn't work
Date: Mon, 14 Mar 2016 09:15:42 +0900	[thread overview]
Message-ID: <56E602AE.7080203@jp.fujitsu.com> (raw)
In-Reply-To: <56E5FF9A.4020609@jp.fujitsu.com>

The number of arguments which is allowed to pass became wrong
from the following commit.

commit 176aeca9a148c5e29de0 ("btrfs-progs: add getopt stubs where needed")

* actual result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  btrfs filesystem label: too few arguments
  usage: btrfs filesystem label [<device>|<mount_point>] [<newlabel>]

      Get or change the label of a filesystem

      With one argument, get the label of filesystem on <device>.
      If <newlabel> is passed, set the filesystem label to <newlabel>.

  # ./btrfs fi label /btrfs bar
  foo
  # ./btrfs prop get /btrfs label
  label=foo
  ===========================================================

* expected result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  foo
  # ./btrfs fi label /btrfs bar
  # ./btrfs prop get /btrfs label
  label=bar
  ===========================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
---
 cmds-filesystem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 7e74e1b..45c16d2 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -1255,11 +1255,11 @@ static int cmd_filesystem_label(int argc, char **argv)
 {
 	clean_args_no_options(argc, argv, cmd_filesystem_label_usage);

-	if (check_argc_min(argc - optind, 2) ||
-			check_argc_max(argc - optind, 3))
+	if (check_argc_min(argc - optind, 1) ||
+			check_argc_max(argc - optind, 2))
 		usage(cmd_filesystem_label_usage);

-	if (argc - optind > 2) {
+	if (argc - optind > 1) {
 		return set_label(argv[optind], argv[optind + 1]);
 	} else {
 		char label[BTRFS_LABEL_SIZE];
-- 
2.7.0

  parent reply	other threads:[~2016-03-14  0:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  0:02 [PATCH 1/4] btrfs-progs: Avoid interpreting options after "--" when getting unit mode Satoru Takeuchi
2016-03-14  0:12 ` [PATCH 2/4] btrfs-progs: fix a reression that "property" with -t option doesn't work Satoru Takeuchi
2016-03-14 12:23   ` David Sterba
2016-03-15 23:28     ` Satoru Takeuchi
2016-03-14  0:15 ` Satoru Takeuchi [this message]
2016-03-14 12:19   ` [PATCH 3/4] btrfs-progs: Fix a regression that btrfs filesystem label " David Sterba
2016-03-14  0:27 ` [PATCH 4/4] btrfs-progs: "device ready" accepts just one device Satoru Takeuchi
2016-03-14 12:05   ` David Sterba
2016-04-25 11:59     ` David Sterba
2016-03-14 12:28 ` [PATCH 1/4] btrfs-progs: Avoid interpreting options after "--" when getting unit mode 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=56E602AE.7080203@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.