From: Phillip Susi <psusi@cfl.rr.com>
To: util-linux@vger.kernel.org
Subject: [PATCH 3/4] partx: don't print error when partition already doesn't exist
Date: Mon, 5 Dec 2011 15:02:51 -0500 [thread overview]
Message-ID: <1323115372-3983-3-git-send-email-psusi@cfl.rr.com> (raw)
If you run partx -d to delete partitions, and there are gaps
in the sequence ( partition 2 exists, but 1 doesn't ), then it
would complain that it had errors trying to remove the partitions
that already don't exist. Changed to ignore the error when
errno == ENXIO.
Signed-off-by: Phillip Susi <psusi@cfl.rr.com>
---
partx/partx.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/partx/partx.c b/partx/partx.c
index 2510ffb..50b0c20 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -303,10 +303,15 @@ static int del_parts(int fd, const char *device, dev_t devno,
}
for (i = lower; i <= upper; i++) {
- if (partx_del_partition(fd, i) == 0) {
+ rc = partx_del_partition(fd, i);
+ if (rc == 0) {
if (verbose)
printf(_("%s: partition #%d removed\n"), device, i);
continue;
+ } else if (errno == ENXIO) {
+ if (verbose)
+ printf(_("%s: partition #%d already doesn't exist\n"), device, i);
+ continue;
}
rc = -1;
if (verbose)
--
1.7.5.4
reply other threads:[~2011-12-05 20:12 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=1323115372-3983-3-git-send-email-psusi@cfl.rr.com \
--to=psusi@cfl.rr.com \
--cc=util-linux@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).