]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Kill: Don't use O_EXCL when --force is used.
authorNeilBrown <neilb@suse.de>
Thu, 18 Dec 2008 03:04:45 +0000 (14:04 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 18 Dec 2008 03:04:45 +0000 (14:04 +1100)
We really want --zero-super --force to zero the superblock in
all situations.  So don't open with O_EXCL - trust the user.

Signed-off-by: NeilBrown <neilb@suse.de>
Kill.c

diff --git a/Kill.c b/Kill.c
index 0a2763eaa20615940a035ce4d7e2b3be8bd2a222..b1e19b56dd8bbdb57d7b4ac9268c8656fff5d0d5 100644 (file)
--- a/Kill.c
+++ b/Kill.c
@@ -44,7 +44,7 @@ int Kill(char *dev, int force, int quiet)
        int fd, rv = 0;
        struct supertype *st;
 
-       fd = open(dev, O_RDWR|O_EXCL);
+       fd = open(dev, O_RDWR|(force ? 0 : O_EXCL));
        if (fd < 0) {
                if (!quiet)
                        fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",