From: NeilBrown Date: Thu, 10 Mar 2011 00:41:21 +0000 (+1100) Subject: dev_open should always open read-only. X-Git-Tag: mdadm-3.1.5~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a821dc7fdf2569a2ea371120771755c87a4f03d3;p=thirdparty%2Fmdadm.git dev_open should always open read-only. When opening an array to manipulate it we never need to write to the array and sometimes it might be read-only so the open for write will fail. So always open read-only. Reported-by: Adam Kwolek Signed-off-by: NeilBrown --- diff --git a/util.c b/util.c index 75a5e6df..52171cc2 100644 --- a/util.c +++ b/util.c @@ -994,7 +994,7 @@ int open_dev(int devnum) char buf[20]; sprintf(buf, "%d:%d", dev2major(devnum), dev2minor(devnum)); - return dev_open(buf, O_RDWR); + return dev_open(buf, O_RDONLY); } int open_dev_excl(int devnum)