diff options
author | Naphtali Sprei <nsprei@redhat.com> | 2010-01-17 16:48:12 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-01-20 08:25:22 -0600 |
commit | b196b1532f2981e9c811c96214a44ee9e7d12af3 (patch) | |
tree | fbff94df456b6d5b44dfe3467fe1c3bd28b3d394 | |
parent | 3dbf2c7fc5682827be6fa436362fb5db221bd210 (diff) |
Make CDROM a read-only drive
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | vl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -2233,6 +2233,13 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque, } (void)bdrv_set_read_only(dinfo->bdrv, 1); } + /* + * cdrom is read-only. Set it now, after above interface checking + * since readonly attribute not explicitly required, so no error. + */ + if (media == MEDIA_CDROM) { + (void)bdrv_set_read_only(dinfo->bdrv, 1); + } if (bdrv_open2(dinfo->bdrv, file, bdrv_flags, drv) < 0) { fprintf(stderr, "qemu: could not open disk image %s: %s\n", |