diff options
author | David Sterba <dsterba@suse.com> | 2016-03-01 16:02:08 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-03-14 13:42:47 +0100 |
commit | babe94e4817aca45aef409b7a21bc47e51cda6ff (patch) | |
tree | a00641b956754d6bd002bb23c6b8e3d3a18b8740 /cmds-quota.c | |
parent | c27640938de1506e0a02f7f928a00886d5da616a (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-quota.c')
-rw-r--r-- | cmds-quota.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cmds-quota.c b/cmds-quota.c index 34b8dacf..568482fc 100644 --- a/cmds-quota.c +++ b/cmds-quota.c @@ -70,7 +70,12 @@ static const char * const cmd_quota_enable_usage[] = { static int cmd_quota_enable(int argc, char **argv) { - int ret = quota_ctl(BTRFS_QUOTA_CTL_ENABLE, argc, argv); + int ret; + + clean_args_no_options(argc, argv, cmd_quota_enable_usage); + + ret = quota_ctl(BTRFS_QUOTA_CTL_ENABLE, argc, argv); + if (ret < 0) usage(cmd_quota_enable_usage); return ret; @@ -84,7 +89,12 @@ static const char * const cmd_quota_disable_usage[] = { static int cmd_quota_disable(int argc, char **argv) { - int ret = quota_ctl(BTRFS_QUOTA_CTL_DISABLE, argc, argv); + int ret; + + clean_args_no_options(argc, argv, cmd_quota_disable_usage); + + ret = quota_ctl(BTRFS_QUOTA_CTL_DISABLE, argc, argv); + if (ret < 0) usage(cmd_quota_disable_usage); return ret; |