Patchwork [1/3] Make CDROM a read-only drive

login
register
mail settings
Submitter Naphtali Sprei
Date Jan. 14, 2010, 2:33 p.m.
Message ID <4B4F2B2D.5040401@redhat.com>
Download mbox | patch
Permalink /patch/42892/
State New
Headers show

Comments

Naphtali Sprei - Jan. 14, 2010, 2:33 p.m.
Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
---
 vl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

Patch

diff --git a/vl.c b/vl.c
index 06cb40d..4f19505 100644
--- a/vl.c
+++ b/vl.c
@@ -2234,6 +2234,10 @@  DriveInfo *drive_init(QemuOpts *opts, void *opaque,
         (void)bdrv_set_read_only(dinfo->bdrv, 1);
     }
 
+    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",
                         file, strerror(errno));