Re: Obsolete coding in fork_process.c - Mailing list pgsql-hackers

From Noah Misch
Subject Re: Obsolete coding in fork_process.c
Date
Msg-id 20140501183231.GA1190179@tornado.leadboat.com
Whole thread Raw
In response to Obsolete coding in fork_process.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Obsolete coding in fork_process.c
List pgsql-hackers
On Thu, May 01, 2014 at 12:13:28PM -0400, Tom Lane wrote:
> fork_process.c quoth:
> 
>     /*
>      * Flush stdio channels just before fork, to avoid double-output problems.
>      * Ideally we'd use fflush(NULL) here, but there are still a few non-ANSI
>      * stdio libraries out there (like SunOS 4.1.x) that coredump if we do.
>      * Presently stdout and stderr are the only stdio output channels used by
>      * the postmaster, so fflush'ing them should be sufficient.
>      */
>     fflush(stdout);
>     fflush(stderr);
> 
> Is there any reason not to change this to just fflush(NULL)?  We dropped
> support for SunOS 4.1 quite some time ago ...

Modern systems have other fflush(NULL) problems:

http://www.nntp.perl.org/group/perl.perl5.porters/2013/09/msg207692.html
http://perl5.git.perl.org/metaconfig.git/blob/master:/U/perl/fflushall.U

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Obsolete coding in fork_process.c
Next
From: Andres Freund
Date:
Subject: Re: quiet inline configure check misses a step for clang