From: mornfall@sourceware.org <mornfall@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/tools pvcreate.c
Date: 17 Mar 2009 14:01:02 -0000 [thread overview]
Message-ID: <20090317140102.27121.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2009-03-17 14:01:01
Modified files:
tools : pvcreate.c
Log message:
Some extra (paranoid) checks on dev_is_{md,swap} result.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80
--- LVM2/tools/pvcreate.c 2009/03/17 13:59:57 1.79
+++ LVM2/tools/pvcreate.c 2009/03/17 14:00:58 1.80
@@ -46,6 +46,7 @@
struct physical_volume *pv;
struct device *dev;
uint64_t md_superblock, swap_signature;
+ int wipe_md, wipe_swap;
/* FIXME Check partition type is LVM unless --force is given */
@@ -117,7 +118,7 @@
}
/* Wipe superblock? */
- if (dev_is_md(dev, &md_superblock) &&
+ if ((wipe_md = dev_is_md(dev, &md_superblock)) == 1 &&
((!pp->idp && !pp->restorefile) || pp->yes ||
(yes_no_prompt("Software RAID md superblock "
"detected on %s. Wipe it? [y/n] ", name) == 'y'))) {
@@ -129,7 +130,13 @@
}
}
- if (dev_is_swap(dev, &swap_signature) &&
+ if (wipe_md == -1) {
+ log_error("Fatal error while trying to detect software "
+ "RAID md superblock on %s", name);
+ return 0;
+ }
+
+ if ((wipe_swap = dev_is_swap(dev, &swap_signature)) == 1 &&
((!pp->idp && !pp->restorefile) || pp->yes ||
(yes_no_prompt("Swap signature detected on %s. Wipe it? [y/n] ",
name) == 'y'))) {
@@ -140,6 +147,12 @@
}
}
+ if (wipe_swap == -1) {
+ log_error("Fatal error while trying to detect swap "
+ "signature on %s", name);
+ return 0;
+ }
+
if (sigint_caught())
return 0;
next reply other threads:[~2009-03-17 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-17 14:01 mornfall [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-03-16 15:48 LVM2/tools pvcreate.c agk
2008-07-25 14:45 wysochanski
2008-07-25 14:12 wysochanski
2008-07-23 19:29 wysochanski
2008-07-21 19:27 wysochanski
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=20090317140102.27121.qmail@sourceware.org \
--to=mornfall@sourceware.org \
--cc=lvm-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.