File 0100-btrfs-progs-Fix-number-of-arguments-check-of-btrfs-f.patch of Package btrfsprogs.356
From ae8f7f687f037c46a9fc61cab5bdfea34419df26 Mon Sep 17 00:00:00 2001
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: Tue, 21 Oct 2014 16:31:17 +0800
Subject: [PATCH 100/303] btrfs-progs: Fix number of arguments check of 'btrfs
fi df'
'btrfs fi df' needs exactly one arguments as mount option,
but as 3.17 we can run 'btrfs fi df' without any argument,
and it will error as "ERROR: can't access '%s'" which means
the argument number does not do what it should.
The bug is caused by manually modify the optind and use check_argc_max()
instead of the original check_argc_exact().
This patch fixes it by not modifying the optind and use check_argc_exact()
again.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
---
cmds-filesystem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index bb5881edef2d..70223d82c3cf 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -241,7 +241,6 @@ static int cmd_df(int argc, char **argv)
DIR *dirstream = NULL;
unsigned unit_mode = UNITS_DEFAULT;
- optind = 1;
while (1) {
int long_index;
static const struct option long_options[] = {
@@ -290,7 +289,7 @@ static int cmd_df(int argc, char **argv)
}
}
- if (check_argc_max(argc, optind + 1))
+ if (check_argc_exact(argc, optind + 1))
usage(cmd_df_usage);
path = argv[optind];
--
2.1.3