aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-device.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-03-01 16:29:16 +0100
committerDavid Sterba <dsterba@suse.com>2016-03-14 13:42:47 +0100
commit358807cc33fb3ed50ddf782e5b32f6e3cc2fa329 (patch)
tree51956616bec899d08dd7d9ca46ed9bf9b6682f55 /cmds-device.c
parent6398ed78f9d52769954ba5fe3c15452c390397a7 (diff)
downloadbtrfs-progs-358807cc33fb3ed50ddf782e5b32f6e3cc2fa329.tar.gz
btrfs-progs-358807cc33fb3ed50ddf782e5b32f6e3cc2fa329.tar.xz
btrfs-progs-358807cc33fb3ed50ddf782e5b32f6e3cc2fa329.zip
btrfs-progs: unify argc min/max checking
We don't want to modify argc. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r--cmds-device.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmds-device.c b/cmds-device.c
index ee999a0..3f800e6 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -246,10 +246,10 @@ static int cmd_device_scan(int argc, char **argv)
}
}
- if (all && check_argc_max(argc, 2))
+ if (all && check_argc_max(argc - optind, 1))
usage(cmd_device_scan_usage);
- if (all || argc == 1) {
+ if (all || argc - optind == 1) {
printf("Scanning for Btrfs filesystems\n");
ret = btrfs_scan_lblkid();
error_on(ret, "error %d while scanning", ret);
@@ -372,8 +372,7 @@ static int cmd_device_stats(int argc, char **argv)
}
}
- argc = argc - optind;
- if (check_argc_exact(argc, 1))
+ if (check_argc_exact(argc - optind, 1))
usage(cmd_device_stats_usage);
dev_path = argv[optind];