From patchwork Thu Dec 17 14:29:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: heinzm@sourceware.org X-Patchwork-Id: 68614 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI739PX025995 for ; Fri, 18 Dec 2009 07:03:09 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id BE4C98E0931; Thu, 17 Dec 2009 09:29:38 -0500 (EST) Received: from int-mx03.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id nBHETbMR008523 for ; Thu, 17 Dec 2009 09:29:37 -0500 Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.12]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBHETaqr025891 for ; Thu, 17 Dec 2009 09:29:36 -0500 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id nBHETOL9029347 for ; Thu, 17 Dec 2009 09:29:24 -0500 Received: (qmail 27774 invoked by uid 9450); 17 Dec 2009 14:29:24 -0000 Date: 17 Dec 2009 14:29:24 -0000 Message-ID: <20091217142924.27772.qmail@sourceware.org> From: heinzm@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -1.374 (AWL,SUBJECT_FUZZY_TION) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.12 X-loop: dm-devel@redhat.com Cc: Subject: [dm-devel] dmraid/lib/device partition.c X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com --- dmraid/lib/device/partition.c 2009/12/16 11:39:18 1.1 +++ dmraid/lib/device/partition.c 2009/12/17 14:29:24 1.2 @@ -23,20 +23,27 @@ list_for_each_entry(rd, &rs->devs, devs) { int fd = open(rd->di->path, O_RDWR); + if (fd < 0) LOG_ERR(lc, 0, "opening %s: %s\n", rd->di->path, strerror(errno)); /* There is no way to enumerate partitions */ for (part.pno = 1; part.pno <= 256; part.pno++) { - if (ioctl(fd, BLKPG, &io) < 0 && errno != ENXIO && - (part.pno < 16 || errno != EINVAL)) + if (ioctl(fd, BLKPG, &io) < 0 && + errno != ENXIO && + (part.pno < 16 || errno != EINVAL)) { + close(fd); LOG_ERR(lc, 0, "removing part %d from %s: %s\n", part.pno, rd->di->path, strerror(errno)); + } } + + close(fd); } + return 1; }