Skip to contentSkip to conversation

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

PATCH Applied Marek Rusinowski 2 participants 2 messages May 4, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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
---
 cmds-subvolume.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
cmds-subvolume.c +2 -3
index 2319684..c444617 100644
@@ -1194,10 +1194,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;
 			}
Signature · 1 line
2.8.1
Applied
#1 lore raw
Quoted 9 lines · Marek Rusinowski

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

Applied, thanks.