aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-quota.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-quota.c
parentc27640938de1506e0a02f7f928a00886d5da616a (diff)
downloadbtrfs-progs-babe94e4817aca45aef409b7a21bc47e51cda6ff.tar.gz
btrfs-progs-babe94e4817aca45aef409b7a21bc47e51cda6ff.tar.xz
btrfs-progs-babe94e4817aca45aef409b7a21bc47e51cda6ff.zip
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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmds-quota.c b/cmds-quota.c
index 34b8dac..568482f 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;