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

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