From a6bbbe60874cd7f92bcf55f75fa26f33957e9b25 Mon Sep 17 00:00:00 2001 From: Marek Rusinowski Date: Wed, 4 May 2016 15:36:35 +0200 Subject: [PATCH] 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 Signed-off-by: David Sterba --- cmds-subvolume.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 7c8ab8f2..e3d2cbce 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -1195,10 +1195,9 @@ static int cmd_subvol_sync(int argc, char **argv) switch (c) { case 's': - sleep_interval = atoi(argv[optind]); + sleep_interval = atoi(optarg); if (sleep_interval < 1) { - error("invalid sleep interval %s", - argv[optind]); + error("invalid sleep interval %s", optarg); ret = 1; goto out; }