Skip to content
Snippets Groups Projects
Commit 92b24cb7 authored by Richard Henderson's avatar Richard Henderson
Browse files

util/log: Combine two logfile closes


Merge the close from the changed_name block with the close
from the !need_to_open_file block.

Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Signed-off-by: default avatarRichard Henderson <richard.henderson@linaro.org>
Message-Id: <20220417183019.755276-37-richard.henderson@linaro.org>
parent beab3447
No related branches found
No related tags found
No related merge requests found
......@@ -157,12 +157,6 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
g_free(global_filename);
global_filename = newname;
filename = newname;
if (logfile) {
qatomic_rcu_set(&global_file, NULL);
call_rcu(logfile, qemu_logfile_free, rcu);
logfile = NULL;
}
} else {
filename = global_filename;
}
......@@ -182,11 +176,12 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
daemonized = is_daemonized();
need_to_open_file = log_flags && (!daemonized || filename);
if (logfile && !need_to_open_file) {
if (logfile && (!need_to_open_file || changed_name)) {
qatomic_rcu_set(&global_file, NULL);
call_rcu(logfile, qemu_logfile_free, rcu);
return true;
logfile = NULL;
}
if (!logfile && need_to_open_file) {
FILE *fd;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment