postgresql/src/common
Daniel Gustafsson 5c7038d70b Refactor pipe_read_line to return the full line
Commit 5b2f4afffe refactored find_other_exec() and in the process
created pipe_read_line() into a static routine for reading a single
line of output, aimed at reading version numbers.  Commit a7e8ece41
later exposed it externally in order to read a postgresql.conf GUC
using "postgres -C ..".  Further, f06b1c598 also made use of it for
reading a version string much like find_other_exec().  The internal
variable remained "pgver", even when used for other purposes.

Since the function requires passing a buffer and its size, and at
most size - 1 bytes will be read via fgets(), there is a truncation
risk when using this for reading GUCs (like how pg_rewind does,
though the risk in this case is marginal).

To keep this as generic functionality for reading a line from a pipe,
this refactors pipe_read_line() into returning an allocated buffer
containing all of the line to remove the risk of silent truncation.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/DEDF73CE-D528-49A3-9089-B3592FD671A9@yesql.se
2024-02-09 15:03:16 +01:00
..
unicode Cleanup for unicode-update build target and test. 2024-01-11 12:35:29 -08:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
archive.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
base64.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
binaryheap.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
blkreftable.c Repair various defects in dc21234005. 2024-01-11 13:06:10 -05:00
checksum_helper.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
compression.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
config_info.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
controldata_utils.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
cryptohash.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
cryptohash_openssl.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
d2s.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
d2s_full_table.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
d2s_intrinsics.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
digit_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
encnames.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
exec.c Refactor pipe_read_line to return the full line 2024-02-09 15:03:16 +01:00
f2s.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
fe_memutils.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
file_perm.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
file_utils.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
hashfn.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
hmac.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
hmac_openssl.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
ip.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
jsonapi.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
keywords.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
kwlookup.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
link-canary.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
logging.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Add a new WAL summarizer process. 2023-12-20 08:42:28 -05:00
md5.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
md5_common.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
md5_int.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
parse_manifest.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
percentrepl.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_get_line.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_lzcompress.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_prng.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgfnames.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
protocol_openssl.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
psprintf.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
relpath.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
restricted_token.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
rmtree.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
ryu_common.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
saslprep.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
scram-common.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
sha1.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
sha1_int.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
sha2.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
sha2_int.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
sprompt.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
string.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
stringinfo.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
unicode_category.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
unicode_norm.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
username.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
wait_error.c Update copyright for 2024 2024-01-03 20:49:05 -05:00
wchar.c Move is_valid_ascii() to ascii.h. 2024-01-29 12:08:57 -06:00