Skip to contentSkip to conversation

kpartx: on delete process partitions in reverse order

PATCH New Guido Guenther 1 participant 1 message Nov 26, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 kpartx: on delete process partitions in reverse order

otherwise we try to remove the extended partition of MSDOS labels (/dev/mapper/mpathX-part[1-4]) before the logical partition /dev/mapper/mpathX-partY (Y>5) which fails.

kpartx/kpartx.c +1 -1
index 554f742..7098d65 100644
@@ -391,7 +391,7 @@ main(int argc, char **argv){
 			break;
 
 		case DELETE:
-			for (j = 0; j < n; j++) {
+			for (j = n-1; j >= 0; j--) {
 				if (safe_sprintf(partname, "%s%s%d",
 					     mapname, delim, j+1)) {
 					fprintf(stderr, "partname too small\n");