Blame SOURCES/0081-RHBZ-1066264-check-prefix-on-rename.patch

f20720
---
f20720
 libmultipath/devmapper.c |   12 ++++++++++--
f20720
 1 file changed, 10 insertions(+), 2 deletions(-)
f20720
f20720
Index: multipath-tools-130222/libmultipath/devmapper.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/devmapper.c
f20720
+++ multipath-tools-130222/libmultipath/devmapper.c
f20720
@@ -1151,6 +1151,8 @@ dm_rename_partmaps (char * old, char * n
f20720
 	unsigned long long size;
f20720
 	char dev_t[32];
f20720
 	int r = 1;
f20720
+	int offset;
f20720
+	char *delim;
f20720
 
f20720
 	if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
f20720
 		return 1;
f20720
@@ -1171,6 +1173,11 @@ dm_rename_partmaps (char * old, char * n
f20720
 	if (dm_dev_t(old, &dev_t[0], 32))
f20720
 		goto out;
f20720
 
f20720
+	if (isdigit(new[strlen(new)-1]))
f20720
+		delim = "p";
f20720
+	else
f20720
+		delim = "";
f20720
+
f20720
 	do {
f20720
 		if (
f20720
 		    /*
f20720
@@ -1198,8 +1205,9 @@ dm_rename_partmaps (char * old, char * n
f20720
 				 * then it's a kpartx generated partition.
f20720
 				 * Rename it.
f20720
 				 */
f20720
-				snprintf(buff, PARAMS_SIZE, "%s%s",
f20720
-					 new, names->name + strlen(old));
f20720
+				for (offset = strlen(old); names->name[offset] && !(isdigit(names->name[offset])); offset++); /* do nothing */
f20720
+				snprintf(buff, PARAMS_SIZE, "%s%s%s",
f20720
+					 new, delim, names->name + offset);
f20720
 				dm_rename(names->name, buff);
f20720
 				condlog(4, "partition map %s renamed",
f20720
 					names->name);