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

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