[vlc-commits] winvlc: disable buffering on stderr

Thomas Guillem git at videolan.org
Tue Nov 28 16:12:45 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 28 11:43:44 2017 +0100| [4ef1d5a27b31b3576b8a0aa40d1dd3518592167f] | committer: Thomas Guillem

winvlc: disable buffering on stderr

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4ef1d5a27b31b3576b8a0aa40d1dd3518592167f
---

 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



More information about the vlc-commits mailing list