postgresql/src/fe_utils
Tom Lane 7fed801135 Clean up inconsistent use of fflush().
More than twenty years ago (79fcde48b), we hacked the postmaster
to avoid a core-dump on systems that didn't support fflush(NULL).
We've mostly, though not completely, hewed to that rule ever since.
But such systems are surely gone in the wild, so in the spirit of
cleaning out no-longer-needed portability hacks let's get rid of
multiple per-file fflush() calls in favor of using fflush(NULL).

Also, we were fairly inconsistent about whether to fflush() before
popen() and system() calls.  While we've received no bug reports
about that, it seems likely that at least some of these call sites
are at risk of odd behavior, such as error messages appearing in
an unexpected order.  Rather than expend a lot of brain cells
figuring out which places are at hazard, let's just establish a
uniform coding rule that we should fflush(NULL) before these calls.
A no-op fflush() is surely of trivial cost compared to launching
a sub-process via a shell; while if it's not a no-op then we likely
need it.

Discussion: https://postgr.es/m/2923412.1661722825@sss.pgh.pa.us
2022-08-29 13:55:41 -04:00
..
.gitignore Move psql's psqlscan.l into src/fe_utils. 2016-03-24 20:28:47 -04:00
Makefile Update copyright for 2022 2022-01-07 19:04:57 -05:00
archive.c Clean up inconsistent use of fflush(). 2022-08-29 13:55:41 -04:00
cancel.c Fix mismatched file identifications 2022-08-09 09:21:37 +07:00
conditional.c Allow pgbench to retry in some cases. 2022-03-23 19:05:45 +09:00
connect_utils.c Remove redundant null pointer checks before free() 2022-07-03 11:47:15 +02:00
mbprint.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
option_utils.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
parallel_slot.c Use correct connection for cancellation in frontend's parallel slots 2022-08-27 15:21:31 +09:00
print.c Clean up inconsistent use of fflush(). 2022-08-29 13:55:41 -04:00
psqlscan.l Reject trailing junk after numeric literals 2022-02-16 10:37:31 +01:00
query_utils.c Remove redundant null pointer checks before PQclear and PQconninfoFree 2022-07-03 20:11:05 +02:00
recovery_gen.c Improve frontend error logging style. 2022-04-08 14:55:14 -04:00
simple_list.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
string_utils.c Fix minor memory leaks in psql's tab completion. 2022-07-22 10:53:26 -04:00