open() can also return EPERM for O_RDWR on a readonly device
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5482 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
60759371f0
commit
a0a83536e0
2
block.c
2
block.c
@ -399,7 +399,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user