From 78b548583e0725bb7054162a31dac552b01c02a8 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 17 Apr 2022 11:29:49 -0700 Subject: *: Use fprintf between qemu_log_trylock/unlock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inside qemu_log, we perform qemu_log_trylock/unlock, which need not be done if we have already performed the lock beforehand. Always check the result of qemu_log_trylock -- only checking qemu_loglevel_mask races with the acquisition of the lock on the logfile. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-Id: <20220417183019.755276-10-richard.henderson@linaro.org> --- include/exec/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/exec') diff --git a/include/exec/log.h b/include/exec/log.h index fb595d1eb7..648f4d2263 100644 --- a/include/exec/log.h +++ b/include/exec/log.h @@ -73,7 +73,7 @@ static inline void log_page_dump(const char *operation) { FILE *logfile = qemu_log_trylock(); if (logfile) { - qemu_log("page layout changed following %s\n", operation); + fprintf(logfile, "page layout changed following %s\n", operation); page_dump(logfile); } qemu_log_unlock(logfile); -- cgit v1.2.3