From patchwork Tue Jul 31 05:15:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: QI Fuli X-Patchwork-Id: 10549881 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 4C30715E2 for ; Tue, 31 Jul 2018 05:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34FC828553 for ; Tue, 31 Jul 2018 05:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24FCB2A03C; Tue, 31 Jul 2018 05:15:34 +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 B913128553 for ; Tue, 31 Jul 2018 05:15:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 84270210C643F; Mon, 30 Jul 2018 22:15:33 -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=211.128.242.41; helo=mgwym02.jp.fujitsu.com; envelope-from=qi.fuli@jp.fujitsu.com; receiver=linux-nvdimm@lists.01.org Received: from mgwym02.jp.fujitsu.com (mgwym02.jp.fujitsu.com [211.128.242.41]) (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 1870121BADAB2 for ; Mon, 30 Jul 2018 22:15:31 -0700 (PDT) Received: from yt-mxoi1.gw.nic.fujitsu.com (unknown [192.168.229.67]) by mgwym02.jp.fujitsu.com with smtp id 3bcb_34a0_a613aee1_09f5_43c1_81be_e01481982b92; Tue, 31 Jul 2018 14:15:26 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by yt-mxoi1.gw.nic.fujitsu.com (Postfix) with ESMTP id 92569AC0153 for ; Tue, 31 Jul 2018 14:15:25 +0900 (JST) Received: from localhost.localdomain (unknown [10.124.196.110]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id 75D1D11F; Tue, 31 Jul 2018 14:15:25 +0900 (JST) From: QI Fuli To: linux-nvdimm@lists.01.org Subject: [ndclt PATCH] ndctl, monitor: Fix duplicate prefix in monitor.log Date: Tue, 31 Jul 2018 14:15:03 +0900 Message-Id: <20180731051503.30719-1-qi.fuli@jp.fujitsu.com> X-Mailer: git-send-email 2.18.0 X-TM-AS-MML: disable X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP When a monitor runs with [--log] option, the prefix will be dually added to monitor.log. Therefore, the monitor cannot log the smart notification to syslog. This patch is used to prevent prefix from being dually added to monitor.log. Fixes: fdf6b6844ccf ("ndctl, monitor: add a new command - monitor") Signed-off-by: QI Fuli Reviewed-by: Masayoshi Mizuma --- ndctl/monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index c6419ad..4e5daf5 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -614,7 +614,8 @@ int cmd_monitor(int argc, const char **argv, void *ctx) goto out; if (monitor.log) { - fix_filename(prefix, (const char **)&monitor.log); + if (strncmp(monitor.log, "./", 2) != 0) + fix_filename(prefix, (const char **)&monitor.log); if (strncmp(monitor.log, "./syslog", 8) == 0) ndctl_set_log_fn((struct ndctl_ctx *)ctx, log_syslog); else if (strncmp(monitor.log, "./standard", 10) == 0)