[PATCH] Don't add 'p' delimiter when you shouldn't

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

 



The 'p' delimiter is supposed to be added when the base disk name ends
in a digit.  This decision was based on the name given on the command
line, not the canonical device name, so giving /dev/dm-0 instead of
/dev/mapper/foo triggered the digit test and added the 'p'.  Changed
test to use the canonical name rather than the given name.

Signed-off-by: Phillip Susi <psusi@xxxxxxxxxx>
---
 kpartx/kpartx.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index 0711450..08f3407 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -323,12 +323,6 @@ main(int argc, char **argv){
 		device = loopdev;
 	}
 
-	if (delim == NULL) {
-		delim = malloc(DELIM_SIZE);
-		memset(delim, 0, DELIM_SIZE);
-		set_delimiter(device, delim);
-	}
-
 	off = find_devname_offset(device);
 
 	if (!loopdev) {
@@ -350,6 +344,12 @@ main(int argc, char **argv){
 		return 0;
 	}
 
+	if (delim == NULL) {
+		delim = malloc(DELIM_SIZE);
+		memset(delim, 0, DELIM_SIZE);
+		set_delimiter(mapname, delim);
+	}
+
 	fd = open(device, O_RDONLY);
 
 	if (fd == -1) {
-- 
1.7.9.5

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel


[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux