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 <[email protected]>
---
 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)
-- 
2.18.0


_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to