btrfs-progs: subvolume sync: fix handling of -s option

Setting check interval for subvolume sync resulted
in picking wrong element from argv for it's value:

  $ btrfs subvolume sync -s 10 ./dir
  ERROR: invalid sleep interval ./dir
  $ btrfs subvolume sync ./dir -s 10
  Segmentation fault

Signed-off-by: Marek Rusinowski <marekrusinowski@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Marek Rusinowski 2016-05-04 15:36:35 +02:00 committed by David Sterba
parent 5c5a622772
commit a6bbbe6087

View File

@ -1195,10 +1195,9 @@ static int cmd_subvol_sync(int argc, char **argv)
switch (c) { switch (c) {
case 's': case 's':
sleep_interval = atoi(argv[optind]); sleep_interval = atoi(optarg);
if (sleep_interval < 1) { if (sleep_interval < 1) {
error("invalid sleep interval %s", error("invalid sleep interval %s", optarg);
argv[optind]);
ret = 1; ret = 1;
goto out; goto out;
} }