From patchwork Tue Dec 17 14:35:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 3362011 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8BB2AC0D4A for ; Tue, 17 Dec 2013 14:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86D83201C8 for ; Tue, 17 Dec 2013 14:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB2352017D for ; Tue, 17 Dec 2013 14:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547Ab3LQOfs (ORCPT ); Tue, 17 Dec 2013 09:35:48 -0500 Received: from cantor2.suse.de ([195.135.220.15]:57241 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752358Ab3LQOfr (ORCPT ); Tue, 17 Dec 2013 09:35:47 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 685A4AC32; Tue, 17 Dec 2013 14:35:46 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 00BA0DA869; Tue, 17 Dec 2013 15:35:45 +0100 (CET) Date: Tue, 17 Dec 2013 15:35:45 +0100 From: David Sterba To: Gui Hecheng Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH] btrfs-progs: fix btrfstune silence on failure Message-ID: <20131217143545.GO6498@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Gui Hecheng , linux-btrfs@vger.kernel.org References: <1386928786-4976-1-git-send-email-guihc.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1386928786-4976-1-git-send-email-guihc.fnst@cn.fujitsu.com> User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 On Fri, Dec 13, 2013 at 05:59:46PM +0800, Gui Hecheng wrote: > Originally, btrfstune will fail without any options and just exit > with no failure prompt. Works for me: $ ./btrfstune usage: btrfstune [options] device -S value enable/disable seeding -r enable extended inode refs -x enable skinny metadata extent refs > Now, the number of arguments are checked before parse options > and error msg will show up upon failure. No, the arguments should be parsed first. The btrfstune utility does not use the same parser helpers like check_argc_exact and actually the bug you see could be caused by missing optind = 1 before the while () loop. Can you please test if this helps? --- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/btrfstune.c +++ b/btrfstune.c @@ -115,6 +115,7 @@ int main(int argc, char *argv[]) int skinny_flag = 0; int ret; + optind = 1; while(1) { int c = getopt(argc, argv, "S:rx"); if (c < 0)