From patchwork Fri Mar 29 11:01:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: QI Fuli X-Patchwork-Id: 10876867 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC1811575 for ; Fri, 29 Mar 2019 11:02:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9240928FCD for ; Fri, 29 Mar 2019 11:02:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8233528F99; Fri, 29 Mar 2019 11:02:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 312D728F99 for ; Fri, 29 Mar 2019 11:02:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A75BD211EC0FC; Fri, 29 Mar 2019 04:02:07 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=202.219.69.169; helo=mgwkm02.jp.fujitsu.com; envelope-from=qi.fuli@jp.fujitsu.com; receiver=linux-nvdimm@lists.01.org Received: from mgwkm02.jp.fujitsu.com (mgwkm02.jp.fujitsu.com [202.219.69.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8EE742194EB70 for ; Fri, 29 Mar 2019 04:02:04 -0700 (PDT) Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm02.jp.fujitsu.com with smtp id 703e_3ac9_c852d667_f226_4a8f_8c1a_cc77dfdd2f65; Fri, 29 Mar 2019 20:02:00 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 113E4AC0112 for ; Fri, 29 Mar 2019 20:01:59 +0900 (JST) Received: from localhost.localdomain (unknown [10.124.196.110]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id DAEB71C2; Fri, 29 Mar 2019 20:01:58 +0900 (JST) From: QI Fuli To: linux-nvdimm@lists.01.org Subject: [ndctl PATCH] monitor: removing the requirement of default config Date: Fri, 29 Mar 2019 20:01:50 +0900 Message-Id: <20190329110150.3725-1-qi.fuli@jp.fujitsu.com> X-Mailer: git-send-email 2.21.0.rc1 MIME-Version: 1.0 X-TM-AS-MML: disable X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Removing the requirement of default configuration file. If "-c, --config-file" option is not specified, default configuration file should be dispensable. Link: https://github.com/pmem/ndctl/issues/83 Signed-off-by: QI Fuli --- ndctl/monitor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index 346a6df..6829a6b 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -484,8 +484,11 @@ static int read_config_file(struct ndctl_ctx *ctx, struct monitor *_monitor, f = fopen(config_file, "r"); if (!f) { - err(&monitor, "config-file: %s cannot be opened\n", config_file); - rc = -errno; + if (_monitor->config_file) { + err(&monitor, "config-file: %s cannot be opened\n", + config_file); + rc = -errno; + } goto out; }