diff options
Diffstat (limited to 'src/include/port.h')
-rw-r--r-- | src/include/port.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/port.h b/src/include/port.h index e7f37559dde..8563cd6158b 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -372,6 +372,20 @@ extern int gettimeofday(struct timeval * tp, struct timezone * tzp); #endif /* WIN32 */ /* + * On Windows, setvbuf() does not support _IOLBF mode, and interprets that + * as _IOFBF. To add insult to injury, setvbuf(file, NULL, _IOFBF, 0) + * crashes outright if "parameter validation" is enabled. Therefore, in + * places where we'd like to select line-buffered mode, we fall back to + * unbuffered mode instead on Windows. Always use PG_IOLBF not _IOLBF + * directly in order to implement this behavior. + */ +#ifndef WIN32 +#define PG_IOLBF _IOLBF +#else +#define PG_IOLBF _IONBF +#endif + +/* * Default "extern" declarations or macro substitutes for library routines. * When necessary, these routines are provided by files in src/port/. */ |