1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-17 01:02:17 +03:00

Fix unportable setvbuf() usage in initdb.

In yesterday's commit 2dc4f011fd, I tried
to force buffering of stdout/stderr in initdb to be what it is by
default when the program is run interactively on Unix (since that's how
most manual testing is done).  This tripped over the fact that Windows
doesn't support _IOLBF mode.  We dealt with that a long time ago in
syslogger.c by falling back to unbuffered mode on Windows.  Export that
solution in port.h and use it in initdb.

Back-patch to 8.4, like the previous commit.
This commit is contained in:
Tom Lane
2014-05-15 15:57:54 -04:00
parent 2f8e68bd7e
commit f62d417825
3 changed files with 18 additions and 15 deletions

View File

@@ -3529,7 +3529,7 @@ main(int argc, char *argv[])
* unexpected output ordering when, eg, output is redirected to a file.
* POSIX says we must do this before any other usage of these files.
*/
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stdout, NULL, PG_IOLBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
progname = get_progname(argv[0]);