From 42157c107d4ffce0ca7f7e7d8c4dbb6f55ccecfa Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Wed, 25 Mar 2020 23:31:35 -0700 Subject: [PATCH] ui: Always connect DVD drive, permit it to be empty --- softmmu/vl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 2abc91f510..4da0f9114f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2948,20 +2948,23 @@ void qemu_init(int argc, char **argv, char **envp) } } - const char *dvd_path; + const char *dvd_path = ""; xemu_settings_get_string(XEMU_SETTINGS_SYSTEM_DVD_PATH, &dvd_path); if (strlen(dvd_path) > 0) { if (xemu_check_file(dvd_path)) { char *msg = g_strdup_printf("Failed to open DVD image file '%s'. Please check machine settings.", dvd_path); xemu_queue_error_message(msg); g_free(msg); - } else { - fake_argv[fake_argc++] = strdup("-drive"); - fake_argv[fake_argc++] = g_strdup_printf("index=1,media=cdrom,file=%s", - dvd_path); + dvd_path = ""; } } + // Always populate DVD drive. If disc path is the empty string, drive is + // connected but no media present. + fake_argv[fake_argc++] = strdup("-drive"); + fake_argv[fake_argc++] = g_strdup_printf("index=1,media=cdrom,file=%s", + dvd_path); + fake_argv[fake_argc++] = strdup("-display"); fake_argv[fake_argc++] = strdup("xemu");