summaryrefslogtreecommitdiff
path: root/cmds-device.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2015-10-10 22:30:57 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-02 09:35:03 +0100
commit89c0e3b706a80e8e69780d5cd784b546399e0b75 (patch)
treeb3b4c6e3aed40bde4595d54ac475c947cbf55f43 /cmds-device.c
parent3b879467b11ee727bba93969868beeefa72a097d (diff)
downloadbtrfs-progs-89c0e3b706a80e8e69780d5cd784b546399e0b75.tar.gz
btrfs-progs: device add: cleanup argument handling
This is needed by the patch which introduces new devid option for the btrfs device delete. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-device.c')
-rw-r--r--cmds-device.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/cmds-device.c b/cmds-device.c
index a9354f5..37fd284 100644
--- a/cmds-device.c
+++ b/cmds-device.c
@@ -53,6 +53,7 @@ static int cmd_device_add(int argc, char **argv)
DIR *dirstream = NULL;
int discard = 1;
int force = 0;
+ int last_dev;
while (1) {
int c;
@@ -77,18 +78,17 @@ static int cmd_device_add(int argc, char **argv)
}
}
- argc = argc - optind;
-
- if (check_argc_min(argc, 2))
+ if (check_argc_min(argc - optind, 2))
usage(cmd_device_add_usage);
- mntpnt = argv[optind + argc - 1];
+ last_dev = argc - 1;
+ mntpnt = argv[last_dev];
fdmnt = btrfs_open_dir(mntpnt, &dirstream, 1);
if (fdmnt < 0)
return 1;
- for (i = optind; i < optind + argc - 1; i++){
+ for (i = optind; i < last_dev; i++){
struct btrfs_ioctl_vol_args ioctl_args;
int devfd, res;
u64 dev_block_count = 0;