NeilBrown: Kill: Don't use O_EXCL when --force is used.

Martin F. Krafft madduck at alioth.debian.org
Mon Feb 16 11:24:11 UTC 2009


Module: mdadm
Branch: build
Commit: 22eba5121632c4b26541fbb04209a90b93c24bcc
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=22eba5121632c4b26541fbb04209a90b93c24bcc

Author: NeilBrown <neilb at suse.de>
Date:   Thu Dec 18 14:04:45 2008 +1100

Kill:  Don't use O_EXCL when --force is used.

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 at suse.de>

---

 Kill.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Kill.c b/Kill.c
index 0a2763e..b1e19b5 100644
--- 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",




More information about the pkg-mdadm-commits mailing list