From patchwork Wed May 4 13:36:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Rusinowski X-Patchwork-Id: 9014081 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EBC449F1C1 for ; Wed, 4 May 2016 13:36:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15D8D20397 for ; Wed, 4 May 2016 13:36:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3576520395 for ; Wed, 4 May 2016 13:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751210AbcEDNgs (ORCPT ); Wed, 4 May 2016 09:36:48 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:34942 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbcEDNgr (ORCPT ); Wed, 4 May 2016 09:36:47 -0400 Received: by mail-lf0-f50.google.com with SMTP id j8so59941302lfd.2 for ; Wed, 04 May 2016 06:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=+nOlMtrKig6CDORkIMhjZQzjtt74P0spe3qgorP+XS4=; b=RzKPbYrrSgE0QwD2dW/l3j8q6pWGQ6wft2ejCMunFiYupB2aWr7vZrauJnk9Vgk0yS qoBjP5kjvC3Ed+wwxOXt4TC8vtlU3RjcVNbzJFkHJawovRw8ZXjezYBTPk8x+jm5IPyz fHVGZeDjQ8IsyGMgb/s3SI2O1h2RLtJrfE2M8KEstOtjP7FI1J1qNzeSKQ77WrDq7FTt KuWHxiBZDHpacbMH/9KHRuhsV6sz0aNJGmVjnB54HY7kXboyPn9+e/zkiw5Ed7oDIouG 20UZEpxuHTI1Re4FSFL5FPDsfc+x4snLcak/uvm0IQYLCqhh0mIrl5iUXtXKcpcwxeld MNzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+nOlMtrKig6CDORkIMhjZQzjtt74P0spe3qgorP+XS4=; b=LWCNsmyntu0CaL8RpwL8csel5b4drtyjygb1VJ+2wd75USKAGxTT94aHbR0bXRdvpS nwwbp3y0DXT6BTgGoQgPUgRJaL5yPEMsoKxtjctEro1hXqHqpZLzGGpGAJCt5rlM0IXk m+IpXyGX7PimmZp7jU8PQiERtwYakmnYtwdMEyXWYpnB7t6FFGnJ25WJOly7aa/7lwWW A76w4jGj9vH9zXx/JmTCQCOS88AzQb+gp2FPhmZgKFJL+NMGCAX0Oq/C6NPwyB+maLmJ mcxxrP2LUEp10urFwW13n4GLOiZE7ctWqY6F3zEDMVZ4NhQjCppgQpD0/hIFKNhcZxs5 /pGA== X-Gm-Message-State: AOPr4FVzUlpEfpL+fhxHz8LoZg4DBQS/qZU+4oUii1NBGcjsgkF0KEknQXNxzEE1vSIdow== X-Received: by 10.25.25.7 with SMTP id 7mr3482045lfz.166.1462369006137; Wed, 04 May 2016 06:36:46 -0700 (PDT) Received: from p2004a-laptop.chello.pl (89-79-179-73.dynamic.chello.pl. [89.79.179.73]) by smtp.gmail.com with ESMTPSA id i1sm629028lbs.22.2016.05.04.06.36.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 May 2016 06:36:44 -0700 (PDT) From: Marek Rusinowski To: linux-btrfs@vger.kernel.org Cc: Marek Rusinowski Subject: [PATCH] btrfs-progs: subvolume sync: fix handling of -s option Date: Wed, 4 May 2016 15:36:35 +0200 Message-Id: <1462368995-24542-1-git-send-email-marekrusinowski@gmail.com> X-Mailer: git-send-email 2.8.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }