diff mbox series

[53/54] multipath: call strchop() on command line argument

Message ID 20200709103623.8302-12-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools series part IV: identify paths by dev_t | expand

Commit Message

Martin Wilck July 9, 2020, 10:36 a.m. UTC
From: Martin Wilck <mwilck@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@suse.com>
---
 multipath/main.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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);