postgresql/src/common
Joe Conway 4598a99cf2 Make get_controlfile not leak file descriptors
When backend functions were added to expose controldata via SQL,
reading of pg_control was consolidated under src/common so that
both frontend and backend could share the same code. That move
from frontend-only to shared frontend-backend failed to recognize
the risk (and coding standards violation) of using a bare open().
In particular, it risked leaking file descriptors if transient
errors occurred while reading the file. Fix that by using
OpenTransientFile() instead in the backend case, which is
purpose-built for this type of usage.

Since there have been no complaints from the field, and an intermittent
failure low risk, no backpatch. Hard failure would of course be bad, but
in that case these functions are probably the least of your worries.

Author: Joe Conway
Reviewed-By: Michael Paquier
Reported by: Michael Paquier
Discussion: https://postgr.es/m/20190227074728.GA15710@paquier.xyz
2019-02-28 15:57:40 -05:00
..
unicode Update copyright for 2019 2019-01-02 12:44:25 -05:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
base64.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
config_info.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
controldata_utils.c Make get_controlfile not leak file descriptors 2019-02-28 15:57:40 -05:00
d2s.c More float test and portability fixes. 2019-02-13 19:35:50 +00:00
d2s_full_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
d2s_intrinsics.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
digit_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
exec.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
f2s.c More float test and portability fixes. 2019-02-13 19:35:50 +00:00
fe_memutils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_perm.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
file_utils.c Tolerate EINVAL when calling fsync() on a directory. 2019-02-24 23:50:20 +13:00
ip.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
keywords.c Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
kwlookup.c Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
link-canary.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
Makefile Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
md5.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_lzcompress.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgfnames.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
psprintf.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
relpath.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
restricted_token.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
rmtree.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
ryu_common.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
saslprep.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
scram-common.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sha2_openssl.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
string.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
unicode_norm.c Remove useless casts 2019-02-13 11:50:09 +01:00
username.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
wait_error.c Update copyright for 2019 2019-01-02 12:44:25 -05:00