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 <marekrusinow...@gmail.com>
---
 cmds-subvolume.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 2319684..c444617 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -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;
                        }
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to