aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--block.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block.c b/block.c
index 9d2adf7..3132c78 100644
--- a/block.c
+++ b/block.c
@@ -281,6 +281,13 @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
}
bs->read_only = read_only;
+
+ if (read_only) {
+ bs->open_flags &= ~BDRV_O_RDWR;
+ } else {
+ bs->open_flags |= BDRV_O_RDWR;
+ }
+
return 0;
}