]> git.proxmox.com Git - mirror_qemu.git/commitdiff
util/log: re-allow switching away from stderr log file
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 4 Oct 2023 12:44:46 +0000 (14:44 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 7 Oct 2023 17:02:33 +0000 (19:02 +0200)
Commit 59bde21374 ("util/log: do not close and reopen log files when
flags are turned off") prevented switching away from stderr on a
subsequent invocation of qemu_set_log_internal(). This prevented
switching away from stderr with the 'logfile' monitor command as well
as an invocation like
> ./qemu-system-x86_64 -trace 'qemu_mutex_lock,file=log'
from opening the specified log file.

Fixes: 59bde21374 ("util/log: do not close and reopen log files when flags are turned off")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-ID: <20231004124446.491481-1-f.ebner@proxmox.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
util/log.c

index def88a9402baee406ca11a6d937a8d982c3bd3d1..d36c98da0b4ee251bd79f8ff5eda3250ec3bd967 100644 (file)
@@ -298,6 +298,8 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
             r->fd = logfile;
             qatomic_rcu_set(&global_file, NULL);
             call_rcu(r, rcu_close_file, rcu);
+        }
+        if (changed_name) {
             logfile = NULL;
         }
     }