Commit a0a83536e04e601bcd831dea44edd0663638bb37

Authored by aurel32
1 parent 60759371

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
Showing 1 changed file with 1 additions and 1 deletions
... ... @@ -399,7 +399,7 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags,
399 399 else
400 400 open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
401 401 ret = drv->bdrv_open(bs, filename, open_flags);
402   - if (ret == -EACCES && !(flags & BDRV_O_FILE)) {
  402 + if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
403 403 ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY);
404 404 bs->read_only = 1;
405 405 }
... ...