diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-posix.c | 2 | ||||
-rw-r--r-- | block/raw-win32.c | 4 | ||||
-rw-r--r-- | block/vmdk.c | 9 |
3 files changed, 8 insertions, 7 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index eea7e56e59..52bbcdae76 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -138,7 +138,7 @@ static int raw_open_common(BlockDriverState *bs, const char *filename, s->open_flags = open_flags | O_BINARY; s->open_flags &= ~O_ACCMODE; - if ((bdrv_flags & BDRV_O_ACCESS) == BDRV_O_RDWR) { + if (bdrv_flags & BDRV_O_RDWR) { s->open_flags |= O_RDWR; } else { s->open_flags |= O_RDONLY; diff --git a/block/raw-win32.c b/block/raw-win32.c index 72acad58f9..01a6d2519e 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -81,7 +81,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags) s->type = FTYPE_FILE; - if ((flags & BDRV_O_ACCESS) == O_RDWR) { + if (flags & BDRV_O_RDWR) { access_flags = GENERIC_READ | GENERIC_WRITE; } else { access_flags = GENERIC_READ; @@ -337,7 +337,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) } s->type = find_device_type(bs, filename); - if ((flags & BDRV_O_ACCESS) == O_RDWR) { + if (flags & BDRV_O_RDWR) { access_flags = GENERIC_READ | GENERIC_WRITE; } else { access_flags = GENERIC_READ; diff --git a/block/vmdk.c b/block/vmdk.c index 4e486225b7..ddc2fcb5bf 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -357,7 +357,7 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename) return -1; } parent_open = 1; - if (bdrv_open(bs->backing_hd, parent_img_name, BDRV_O_RDONLY) < 0) + if (bdrv_open(bs->backing_hd, parent_img_name, 0) < 0) goto failure; parent_open = 0; } @@ -371,9 +371,10 @@ static int vmdk_open(BlockDriverState *bs, const char *filename, int flags) uint32_t magic; int l1_size, i, ret; - if (parent_open) - // Parent must be opened as RO. - flags = BDRV_O_RDONLY; + if (parent_open) { + /* Parent must be opened as RO, no RDWR. */ + flags = 0; + } ret = bdrv_file_open(&s->hd, filename, flags); if (ret < 0) |