aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-zero-log.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 /btrfs-zero-log.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 'btrfs-zero-log.c')
-rw-r--r--btrfs-zero-log.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/btrfs-zero-log.c b/btrfs-zero-log.c
index 4c4ed10..f5ca9fc 100644
--- a/btrfs-zero-log.c
+++ b/btrfs-zero-log.c
@@ -39,23 +39,23 @@ int main(int argc, char **argv)
int ret;
set_argv0(argv);
- if (check_argc_exact(argc, 2))
+ if (check_argc_exact(argc - optind, 1))
print_usage();
radix_tree_init();
printf("WARNING: this utility is deprecated, please use 'btrfs rescue zero-log'\n\n");
- if ((ret = check_mounted(argv[1])) < 0) {
+ if ((ret = check_mounted(argv[optind])) < 0) {
fprintf(stderr, "ERROR: could not check mount status: %s\n", strerror(-ret));
goto out;
} else if (ret) {
- fprintf(stderr, "ERROR: %s is currently mounted\n", argv[1]);
+ fprintf(stderr, "ERROR: %s is currently mounted\n", argv[optind]);
ret = -EBUSY;
goto out;
}
- root = open_ctree(argv[1], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
+ root = open_ctree(argv[optind], 0, OPEN_CTREE_WRITES | OPEN_CTREE_PARTIAL);
if (!root) {
fprintf(stderr, "ERROR: cannot open ctree\n");
return 1;
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
sb = root->fs_info->super_copy;
printf("Clearing log on %s, previous log_root %llu, level %u\n",
- argv[1],
+ argv[optind],
(unsigned long long)btrfs_super_log_root(sb),
(unsigned)btrfs_super_log_root_level(sb));
trans = btrfs_start_transaction(root, 1);