aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-13 21:08:34 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2008-10-13 21:08:34 +0000
commita0a83536e04e601bcd831dea44edd0663638bb37 (patch)
treecd3e91396ae640785a39f33f7f1ddd63913da6fd /block.c
parent60759371f0e08694bef702f4beaf0d35f932de42 (diff)
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
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block.c b/block.c
index 3eb4526164..5d708baada 100644
--- a/block.c
+++ b/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;
}