2/5: open() can also return EPERM for O_RDWR on a readonly device
PATCH 1/1 2/5: open() can also return EPERM for O_RDWR on a readonly device
..at least on FreeBSD. (I think the case where this happened was a cdrom.)
Index: qemu/block.c
@@ -381,7 +381,7 @@
else
open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
ret = drv->bdrv_open(bs, filename, open_flags);
- if (ret == -EACCES && !(flags & BDRV_O_FILE)) {
+ if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY);
bs->read_only = 1;
}Signed-off-by Juergen Lock <[email protected]>
Aurelien Jarno
AppliedApplied, thanks.
Quoted 17 lines · Juergen Lock
..at least on FreeBSD. (I think the case where this happened was a cdrom.)
Index:
qemu/block.c(quoted diff) +1
-1@@ -381,7 +381,7 @@ else open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT); ret = drv->bdrv_open(bs, filename, open_flags); - if (ret == -EACCES && !(flags & BDRV_O_FILE)) { + if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY); bs->read_only = 1; }Signed-off-by Juergen Lock <[email protected]>
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net