[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [multipath-tools] [patch] fix select_alias weirdness



In select_alias, the code that tries to pull the alias from dm_get_name()
sets mp->alias. So even if it fails,  mp->alias will never get set to mp->wwid. 

This patch fixes that.

-Ben
diff -urpN mp-devel-clean/libmultipath/propsel.c mp-devel-patched/libmultipath/propsel.c
--- mp-devel-clean/libmultipath/propsel.c	2006-05-23 11:12:15.000000000 -0500
+++ mp-devel-patched/libmultipath/propsel.c	2006-05-31 13:33:13.000000000 -0500
@@ -165,10 +165,16 @@ select_alias (struct multipath * mp)
 		if (conf->user_friendly_names)
 			mp->alias = get_user_friendly_alias(mp->wwid,
 					conf->bindings_file);
-		if (mp->alias == NULL)
-			if ((mp->alias = MALLOC(WWID_SIZE)) != NULL)
-				dm_get_name(mp->wwid, DEFAULT_TARGET,
-					    mp->alias);
+		if (mp->alias == NULL){
+			char *alias;
+			if ((alias = MALLOC(WWID_SIZE)) != NULL){
+				if (dm_get_name(mp->wwid, DEFAULT_TARGET,
+						alias) == 1)
+					mp->alias = alias;
+				else
+					FREE(alias);
+			}
+		}
 		if (mp->alias == NULL)
 			mp->alias = mp->wwid;
 	}

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]