]> xenbits.xensource.com Git - qemu-xen-4.2-testing.git/commitdiff
w32: Disable buffering for log file
authorStefan Weil <sw@weilnetz.de>
Sat, 3 Dec 2011 21:32:37 +0000 (22:32 +0100)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 10 Dec 2011 17:05:48 +0000 (17:05 +0000)
W32 does not support line buffering, but it supports unbuffered output.

Unbuffered output is better for writing to qemu.log than fully buffered
output because it also shows the latest log messages when an application
crash occurs.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec.c

diff --git a/exec.c b/exec.c
index 6b92198e622dd2da214ff3aa56b9ef384d1efc33..d8b21801708f8069d42edaf449db17f8fdf75b60 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1603,8 +1603,10 @@ void cpu_set_log(int log_flags)
             static char logfile_buf[4096];
             setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));
         }
-#elif !defined(_WIN32)
-        /* Win32 doesn't support line-buffering and requires size >= 2 */
+#elif defined(_WIN32)
+        /* Win32 doesn't support line-buffering, so use unbuffered output. */
+        setvbuf(logfile, NULL, _IONBF, 0);
+#else
         setvbuf(logfile, NULL, _IOLBF, 0);
 #endif
         log_append = 1;