Blame SOURCES/0157-RHBZ-1319853-multipath-c-error-msg.patch

4728c8
---
4728c8
 libmultipath/alias.c |    8 ++++++++
4728c8
 libmultipath/alias.h |    1 +
4728c8
 multipath/main.c     |    7 ++++++-
4728c8
 3 files changed, 15 insertions(+), 1 deletion(-)
4728c8
4728c8
Index: multipath-tools-130222/libmultipath/alias.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/alias.c
4728c8
+++ multipath-tools-130222/libmultipath/alias.c
4728c8
@@ -36,6 +36,14 @@
4728c8
  * See the file COPYING included with this distribution for more details.
4728c8
  */
4728c8
 
4728c8
+int
4728c8
+valid_alias(char *alias)
4728c8
+{
4728c8
+	if (strchr(alias, '/') != NULL)
4728c8
+		return 0;
4728c8
+	return 1;
4728c8
+}
4728c8
+
4728c8
 
4728c8
 static int
4728c8
 format_devname(char *name, int id, int len, char *prefix)
4728c8
Index: multipath-tools-130222/libmultipath/alias.h
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/alias.h
4728c8
+++ multipath-tools-130222/libmultipath/alias.h
4728c8
@@ -7,6 +7,7 @@
4728c8
 "# alias wwid\n" \
4728c8
 "#\n"
4728c8
 
4728c8
+int valid_alias(char *alias);
4728c8
 char *get_user_friendly_alias(char *wwid, char *file, char *prefix,
4728c8
 			      int bindings_readonly);
4728c8
 int get_user_friendly_wwid(char *alias, char *buff, char *file);
4728c8
Index: multipath-tools-130222/multipath/main.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipath/main.c
4728c8
+++ multipath-tools-130222/multipath/main.c
4728c8
@@ -454,8 +454,9 @@ get_dev_type(char *dev) {
4728c8
 	}
4728c8
 	else if (sscanf(dev, "%d:%d", &i, &i) == 2)
4728c8
 		return DEV_DEVT;
4728c8
-	else
4728c8
+	else if (valid_alias(dev))
4728c8
 		return DEV_DEVMAP;
4728c8
+	return DEV_NONE;
4728c8
 }
4728c8
 
4728c8
 int
4728c8
@@ -607,6 +608,10 @@ main (int argc, char *argv[])
4728c8
 
4728c8
 		strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
4728c8
 		conf->dev_type = get_dev_type(conf->dev);
4728c8
+		if (conf->dev_type == DEV_NONE) {
4728c8
+			condlog(0, "'%s' is not a valid argument\n", conf->dev);
4728c8
+			goto out;
4728c8
+		}
4728c8
 	}
4728c8
 	conf->daemon = 0;
4728c8