[vlc-devel] [PATCH] winvlc: disable buffering on stderr

Thomas Guillem thomas at gllm.fr
Tue Nov 28 11:45:07 CET 2017


cf. discussion on the gdb project:
http://sourceware.org/ml/gdb-patches/2013-08/msg00422.html

stderr can be buffered on Windows when connected to a pipe.
---
 bin/winvlc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/bin/winvlc.c b/bin/winvlc.c
index cd7ee95fe2..abef6a816d 100644
--- a/bin/winvlc.c
+++ b/bin/winvlc.c
@@ -129,6 +129,12 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share");
 #endif
 
+#ifndef NDEBUG
+    /* Disable stderr buffering. Indeed, stderr can be buffered on Windows (if
+     * connected to a pipe). */
+    setvbuf (stderr, NULL, _IONBF, BUFSIZ);
+#endif
+
 #if (_WIN32_WINNT < _WIN32_WINNT_WIN7)
     SetErrorMode(SEM_FAILCRITICALERRORS);
 #endif
-- 
2.11.0



More information about the vlc-devel mailing list