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

Submitted by Naphtali Sprei on Jan. 14, 2010, 2:33 p.m.

Details

Message ID 4B4F2B2D.5040401@redhat.com
State New
Headers show

Commit Message

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 hide | download patch | download mbox

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));