Skip to content

Commit

Permalink
util/log: re-allow switching away from stderr log file
Browse files Browse the repository at this point in the history
Commit 59bde21 ("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: 59bde21 ("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>
  • Loading branch information
foxmox authored and bonzini committed Oct 7, 2023
1 parent 044431c commit f05142d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions util/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit f05142d

Please sign in to comment.