diff options
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -4103,10 +4103,15 @@ int bdrv_img_create(const char *filename, const char *fmt, if (backing_file && backing_file->value.s) { uint64_t size; char buf[32]; + int back_flags; + + /* backing files always opened read-only */ + back_flags = + flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING); bs = bdrv_new(""); - ret = bdrv_open(bs, backing_file->value.s, flags, backing_drv); + ret = bdrv_open(bs, backing_file->value.s, back_flags, backing_drv); if (ret < 0) { error_report("Could not open '%s'", backing_file->value.s); goto out; |