Obsolete coding in fork_process.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Obsolete coding in fork_process.c
Date: 2014-05-01 16:13:28
Message-ID: 30040.1398960808@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 ...

While it's still true that the postmaster proper doesn't need to fflush
anything but stdout and stderr, this coding seems a bit less than safe
when you consider the possibility of third-party libraries loaded into the
postmaster process.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2014-05-01 18:32:31 Re: Obsolete coding in fork_process.c
Previous Message Bruce Momjian 2014-05-01 16:09:34 Re: Display of timestamp in pg_dump custom format