summary refs log tree commit diff stats
path: root/include/qemu/log.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/qemu/log.h')
-rw-r--r--include/qemu/log.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/qemu/log.h b/include/qemu/log.h
index 452700329e..6b0db02efc 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -116,8 +116,12 @@ static inline void qemu_log_flush(void)
 /* Close the log file */
 static inline void qemu_log_close(void)
 {
-    fclose(qemu_logfile);
-    qemu_logfile = NULL;
+    if (qemu_logfile) {
+        if (qemu_logfile != stderr) {
+            fclose(qemu_logfile);
+        }
+        qemu_logfile = NULL;
+    }
 }
 
 /* Set up a new log file */