From patchwork Mon Jan 7 19:56:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Susi X-Patchwork-Id: 1942451 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork2.kernel.org (Postfix) with ESMTP id E83E9DF215 for ; Mon, 7 Jan 2013 20:00:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r07JuVAb009333; Mon, 7 Jan 2013 14:56:33 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r07JuUUD013015 for ; Mon, 7 Jan 2013 14:56:30 -0500 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r07JuTNp015026 for ; Mon, 7 Jan 2013 14:56:29 -0500 Received: from iriserv.iradimed.com (rrcs-67-78-168-186.se.biz.rr.com [67.78.168.186]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r07JuRxW019092 for ; Mon, 7 Jan 2013 14:56:28 -0500 Received: by iriserv.iradimed.com (Postfix, from userid 1000) id ECF5354BDC; Mon, 7 Jan 2013 14:56:26 -0500 (EST) From: Phillip Susi To: dm-devel@redhat.com Date: Mon, 7 Jan 2013 14:56:21 -0500 Message-Id: <1357588581-29831-1-git-send-email-psusi@ubuntu.com> X-RedHat-Spam-Score: 0.531 (BAYES_00,RCVD_IN_BRBL_LASTEXT,RDNS_DYNAMIC) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: Phillip Susi Subject: [dm-devel] [PATCH] Don't add 'p' delimiter when you shouldn't X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 --- 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) {