summaryrefslogtreecommitdiff
path: root/cmds-balance.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-03-01 16:02:08 +0100
committerDavid Sterba <dsterba@suse.com>2016-03-14 13:42:47 +0100
commitbabe94e4817aca45aef409b7a21bc47e51cda6ff (patch)
treea00641b956754d6bd002bb23c6b8e3d3a18b8740 /cmds-balance.c
parentc27640938de1506e0a02f7f928a00886d5da616a (diff)
btrfs-progs: add getopt stubs where needed
Commands that do not take any options do not use getopt, which means the standard option separator "--" does not work. Update all command handlers that need it, argv needs to be referenced using the optind that is correctly pointed after the separator. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-balance.c')
-rw-r--r--cmds-balance.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/cmds-balance.c b/cmds-balance.c
index e0d10aae..33f91e41 100644
--- a/cmds-balance.c
+++ b/cmds-balance.c
@@ -612,10 +612,12 @@ static int cmd_balance_pause(int argc, char **argv)
int e;
DIR *dirstream = NULL;
- if (check_argc_exact(argc, 2))
+ clean_args_no_options(argc, argv, cmd_balance_pause_usage);
+
+ if (check_argc_exact(argc - optind, 1))
usage(cmd_balance_pause_usage);
- path = argv[1];
+ path = argv[optind];
fd = btrfs_open_dir(path, &dirstream, 1);
if (fd < 0)
@@ -651,10 +653,12 @@ static int cmd_balance_cancel(int argc, char **argv)
int e;
DIR *dirstream = NULL;
- if (check_argc_exact(argc, 2))
+ clean_args_no_options(argc, argv, cmd_balance_cancel_usage);
+
+ if (check_argc_exact(argc - optind, 1))
usage(cmd_balance_cancel_usage);
- path = argv[1];
+ path = argv[optind];
fd = btrfs_open_dir(path, &dirstream, 1);
if (fd < 0)
@@ -691,10 +695,12 @@ static int cmd_balance_resume(int argc, char **argv)
int ret;
int e;
- if (check_argc_exact(argc, 2))
+ clean_args_no_options(argc, argv, cmd_balance_resume_usage);
+
+ if (check_argc_exact(argc - optind, 1))
usage(cmd_balance_resume_usage);
- path = argv[1];
+ path = argv[optind];
fd = btrfs_open_dir(path, &dirstream, 1);
if (fd < 0)