From: Phillip Susi Date: Thu, 9 Feb 2012 20:16:21 +0000 (+0100) Subject: [kpartx] Don't add 'p' delimiter when you shouldn't X-Git-Tag: upstream/0.5.0~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02ce0e8f40f10c0d0c6ad15b3abd02cb43653879;p=platform%2Fupstream%2Fmultipath-tools.git [kpartx] Don't add 'p' delimiter when you shouldn't 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. --- diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index 0711450..b5e0a32 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(device, delim); + } + fd = open(device, O_RDONLY); if (fd == -1) {