postgresql/src
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
..
backend Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkeys() 2024-02-09 12:56:54 +02:00
bin Refactor pipe_read_line to return the full line 2024-02-09 15:03:16 +01:00
common Refactor pipe_read_line to return the full line 2024-02-09 15:03:16 +01:00
fe_utils Update copyright for 2024 2024-01-03 20:49:05 -05:00
include Refactor pipe_read_line to return the full line 2024-02-09 15:03:16 +01:00
interfaces libpq: Change some static functions to extern 2024-02-04 16:35:16 +01:00
makefiles Add backend support for injection points 2024-01-22 10:15:50 +09:00
pl Fix plpgsql to allow new-style SQL CREATE FUNCTION as a SQL command. 2024-01-18 16:11:16 -05:00
port Update copyright for 2024 2024-01-03 20:49:05 -05:00
template
test Fix usage of aggregate pathkeys in group_keys_reorder_by_pathkeys() 2024-02-09 12:56:54 +02:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Fix various issues with ALTER TEXT SEARCH CONFIGURATION 2024-01-31 13:15:21 +09:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove make function vpathsearch 2024-01-29 07:24:59 +01:00
Makefile.shlib Support shared libraries on Android (using make) 2024-01-23 20:37:49 +01:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00