[dm-devel] [PATCH 53/54] multipath: call strchop() on command line argument

mwilck at suse.com mwilck at suse.com
Thu Jul 9 10:36:22 UTC 2020


From: Martin Wilck <mwilck at suse.com>

It's useful to sanitize these right away. We can't do this for DEV_DEVMAP,
as aliases with trailing whitespace aren't strictly forbidden, but for
the other types we can.

Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 multipath/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/multipath/main.c b/multipath/main.c
index 4c43314..cfb85dc 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -1028,6 +1028,8 @@ main (int argc, char *argv[])
 			condlog(0, "'%s' is not a valid argument\n", dev);
 			goto out;
 		}
+		if (dev_type == DEV_DEVNODE || dev_type == DEV_DEVT)
+			strchop(dev);
 	}
 	if (dev_type == DEV_UEVENT) {
 		openlog("multipath", 0, LOG_DAEMON);
-- 
2.26.2





More information about the dm-devel mailing list