Commit bf65f53fbaaca39600017247108b0627033f2fb1
Committed by
Anthony Liguori
1 parent
8fde6546
Remove setvbuf(<handle>, NULL, _IOLBF, 0) calls for Win32
On Win32 the setvbuf function requires the last parameter to be size between 2 and INT_MAX bytes, so the calls always failed. Since the whole point of the calls is to set line-buffered mode for the file handle and that's not supported on Win32 anyway, conditionally remove them. Signed-off-by: Filip Navara <filip.navara@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
2 changed files
with
5 additions
and
1 deletions
exec.c
... | ... | @@ -1491,7 +1491,8 @@ void cpu_set_log(int log_flags) |
1491 | 1491 | static char logfile_buf[4096]; |
1492 | 1492 | setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf)); |
1493 | 1493 | } |
1494 | -#else | |
1494 | +#elif !defined(_WIN32) | |
1495 | + /* Win32 doesn't support line-buffering and requires size >= 2 */ | |
1495 | 1496 | setvbuf(logfile, NULL, _IOLBF, 0); |
1496 | 1497 | #endif |
1497 | 1498 | log_append = 1; | ... | ... |
vl.c
... | ... | @@ -5755,7 +5755,10 @@ int main(int argc, char **argv, char **envp) |
5755 | 5755 | exit(1); |
5756 | 5756 | } |
5757 | 5757 | |
5758 | +#ifndef _WIN32 | |
5759 | + /* Win32 doesn't support line-buffering and requires size >= 2 */ | |
5758 | 5760 | setvbuf(stdout, NULL, _IOLBF, 0); |
5761 | +#endif | |
5759 | 5762 | |
5760 | 5763 | init_timers(); |
5761 | 5764 | if (init_timer_alarm() < 0) { | ... | ... |