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

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