summaryrefslogtreecommitdiff
path: root/Kill.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2008-07-12 20:28:33 +1000
committerNeil Brown <neilb@suse.de>2008-07-12 20:28:33 +1000
commit6416d5275d65be25a6cd63583bb2b92e6fba95a5 (patch)
tree23757b31666774c05c405dfd720dc92b3bb03b90 /Kill.c
parent908ef18519f7d5780ebf00b19b913f8282eb4175 (diff)
Use O_DIRECT for all IO to devices.
Using buffered IO risks non-atomic updates to parts of the device that we don't actually want to write to. This isn't in general safe. So switch to O_DIRECT for all that IO and make sure we have properly aligned buffers.
Diffstat (limited to 'Kill.c')
-rw-r--r--Kill.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kill.c b/Kill.c
index eb747541..d5c1e36d 100644
--- a/Kill.c
+++ b/Kill.c
@@ -44,7 +44,7 @@ int Kill(char *dev, int force, int quiet, int noexcl)
int fd, rv = 0;
struct supertype *st;
- fd = open(dev, noexcl ? O_RDWR : (O_RDWR|O_EXCL));
+ fd = open(dev, O_DIRECT | (noexcl ? O_RDWR : (O_RDWR|O_EXCL)));
if (fd < 0) {
if (!quiet)
fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",