Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79fcde4

Browse files
committed
Portability fix for old SunOS releases: fflush(NULL)
doesn't work there. Fortunately the postmaster only has stdout and stderr to flush.
1 parent 9e0e148 commit 79fcde4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.97 1998/09/01 04:31:21 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.98 1998/11/29 01:51:56 tgl Exp $
1414
*
1515
* NOTES
1616
*
@@ -1289,10 +1289,14 @@ BackendStartup(Port *port)
12891289
}
12901290

12911291
/*
1292-
* Flush all stdio channels just before fork, to avoid double-output
1293-
* problems.
1292+
* Flush stdio channels just before fork, to avoid double-output problems.
1293+
* Ideally we'd use fflush(NULL) here, but there are still a few non-ANSI
1294+
* stdio libraries out there (like SunOS 4.1.x) that coredump if we do.
1295+
* Presently stdout and stderr are the only stdio output channels used
1296+
* by the postmaster, so fflush'ing them should be sufficient.
12941297
*/
1295-
fflush(NULL);
1298+
fflush(stdout);
1299+
fflush(stderr);
12961300

12971301
if ((pid = fork()) == 0)
12981302
{ /* child */

0 commit comments

Comments
 (0)