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

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