msvc: fix setvbuf() call

The VS2015 version of the CRT asserts when you
pass a zero buffer length and request line buffering.
This fix sets it to the default BUFSIZ.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler
2016-06-06 11:06:28 -04:00
committed by Johannes Schindelin
parent a67216c64c
commit a767609da1

View File

@@ -15,7 +15,12 @@ void vreportf(const char *prefix, const char *err, va_list params)
fflush(fh);
if (!tweaked_error_buffering) {
#if defined(_MSC_VER)
/* UCRT doesn't like zero buffer size */
setvbuf(fh, NULL, _IOLBF, BUFSIZ);
#else
setvbuf(fh, NULL, _IOLBF, 0);
#endif
tweaked_error_buffering = 1;
}