All of lore.kernel.org
 help / color / mirror / Atom feed
From: bmarzins@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: multipath-tools/kpartx kpartx.c
Date: 8 Apr 2011 05:34:35 -0000	[thread overview]
Message-ID: <20110408053435.1818.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2011-04-08 05:34:34

Modified files:
	kpartx         : kpartx.c 

Log message:
	more work for 578109.  The previous loop deleting fix didn't work if there were
	no partitions on the loop device. Now it handles that case as well.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/kpartx.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.9.2.4&r2=1.9.2.5

--- multipath-tools/kpartx/kpartx.c	2011/03/07 05:19:37	1.9.2.4
+++ multipath-tools/kpartx/kpartx.c	2011/04/08 05:34:33	1.9.2.5
@@ -182,7 +182,8 @@
 
 int
 main(int argc, char **argv){
-        int fd, i, j, k, n, op, off, arg;
+        int i, j, k, n, op, off, arg;
+	int fd = -1;
 	struct slice all;
 	struct pt *ptp;
 	enum action what = LIST;
@@ -342,8 +343,10 @@
 			printf("%s: %d slices\n", ptp->type, n);
 #endif
 
-		if (n > 0)
+		if (n > 0) {
 			close(fd);
+			fd = -1;
+		}
 		else
 			continue;
 
@@ -371,15 +374,6 @@
 					slices[j].size, device,
 				        slices[j].start);
 			}
-			if (loopcreated && S_ISREG (buf.st_mode)) {
-				if (del_loop(device)) {
-					if (verbose)
-						printf("can't del loop : %s\n",
-						       device);
-					exit(1);
-				}
-				printf("loop deleted : %s\n", device);
-			}
 			break;
 
 		case DELETE:
@@ -457,6 +451,17 @@
 		if (n > 0)
 			break;
 	}
+	if (what == LIST && loopcreated && S_ISREG (buf.st_mode)) {
+		if (fd != -1)
+			close(fd);
+		if (del_loop(device)) {
+			if (verbose)
+				printf("can't del loop : %s\n",
+				       device);
+			exit(1);
+		}
+		printf("loop deleted : %s\n", device);
+	}
 	dm_lib_release();
 	dm_lib_exit();
 

                 reply	other threads:[~2011-04-08  5:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110408053435.1818.qmail@sourceware.org \
    --to=bmarzins@sourceware.org \
    --cc=dm-cvs@sourceware.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.