aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blockdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/blockdev.c b/blockdev.c
index be88098d53..0a9dec364e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -589,7 +589,7 @@ int do_change_block(Monitor *mon, const char *device,
if (eject_device(mon, bs, 0) < 0) {
return -1;
}
- bdrv_flags = bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM ? 0 : BDRV_O_RDWR;
+ bdrv_flags = bdrv_is_read_only(bs) ? 0 : BDRV_O_RDWR;
if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) {
qerror_report(QERR_OPEN_FILE_FAILED, filename);
return -1;