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 <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
b8b8eda804
commit
82a7851e5f
2
util.c
2
util.c
|
@ -1003,7 +1003,7 @@ int open_dev(int devnum)
|
||||||
char buf[20];
|
char buf[20];
|
||||||
|
|
||||||
sprintf(buf, "%d:%d", dev2major(devnum), dev2minor(devnum));
|
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)
|
int open_dev_excl(int devnum)
|
||||||
|
|
Loading…
Reference in New Issue