]> granicus.if.org Git - postgresql/commit
In initdb, ensure stdout/stderr buffering behavior is what we expect.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 15 May 2014 01:14:06 +0000 (21:14 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 15 May 2014 01:14:06 +0000 (21:14 -0400)
commit5e798475cc4f23ac2a68d254a5db2e57995a870e
treedee6009e3476ec9c9daa823b0a9e8af64f00fd54
parentc87c43f087c569b7ceaa3fc25021dd897e4ca7c4
In initdb, ensure stdout/stderr buffering behavior is what we expect.

Since this program may print to either stdout or stderr, the relative
ordering of its messages depends on the buffering behavior of those files.
Force stdout to be line-buffered and stderr to be unbuffered, ensuring
that the behavior will match standard Unix interactive behavior, even
when stdout and stderr are rerouted to a file.

Per complaint from Tomas Vondra.  The particular case he pointed out is
new in HEAD, but issues of the same sort could arise in any branch with
other error messages, so back-patch to all branches.

I'm unsure whether we might not want to do this in other client programs
as well.  For the moment, just fix initdb.
src/bin/initdb/initdb.c