]> git.proxmox.com Git - mirror_qemu.git/commitdiff
trace: skip qemu_set_log_filename if no "-D" option was passed
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 9 Feb 2021 14:57:59 +0000 (15:57 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 6 Mar 2021 10:42:57 +0000 (11:42 +0100)
When the "simple" backend is not active but the "log" backend is,
both "-trace file=" and "-D" will result in a call to
qemu_set_log_filename.  Unfortunately, QEMU was also calling
qemu_set_log_filename if "-D" was not passed, so the "-trace
file=" option had no effect and the tracepoints went back to
stderr.

Fortunately we can just skip qemu_set_log_filename in that case,
because the log backend will initialize itself just fine as soon
as qemu_set_log is called, also in qemu_process_early_options.

Cc: stefanha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210209145759.141231-3-pbonzini@redhat.com>

softmmu/vl.c

index 2f4958db2a3ef85d35cf844ef24ab437e95b995d..ff488ea3e7db3e86bc7fda82db05cd58211eb750 100644 (file)
@@ -2364,7 +2364,9 @@ static void qemu_process_early_options(void)
 #endif
 
     /* Open the logfile at this point and set the log mask if necessary.  */
-    qemu_set_log_filename(log_file, &error_fatal);
+    if (log_file) {
+        qemu_set_log_filename(log_file, &error_fatal);
+    }
     if (log_mask) {
         int mask;
         mask = qemu_str_to_log_mask(log_mask);