postgresql/src/bin
Tom Lane 244c047205 Fix some cases of indirectly casting away const.
Newest versions of gcc+glibc are able to detect cases where code
implicitly casts away const by assigning the result of strchr() or
a similar function applied to a "const char *" value to a target
variable that's just "char *".  This of course creates a hazard of
not getting a compiler warning about scribbling on a string one was
not supposed to, so fixing up such cases is good.

This patch fixes a dozen or so places where we were doing that.
Most are trivial additions of "const" to the target variable,
since no actually-hazardous change was occurring.

Thanks to Bertrand Drouvot for finding a couple more spots than
I had.

This commit back-patches relevant portions of 8f1791c61 and
9f7565c6c into supported branches.  However, there are two
places in ecpg (in v18 only) where a proper fix is more
complicated than seems appropriate for a back-patch.  I opted
to silence those two warnings by adding casts.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us
Discussion: https://postgr.es/m/3988414.1771950285@sss.pgh.pa.us
Backpatch-through: 14-18
2026-02-25 11:19:50 -05:00
..
initdb Translation updates 2026-02-08 15:11:05 +01:00
pg_amcheck Translation updates 2026-02-08 15:11:05 +01:00
pg_archivecleanup Translation updates 2026-02-08 15:11:05 +01:00
pg_basebackup Translation updates 2026-02-08 15:11:05 +01:00
pg_checksums Translation updates 2026-02-08 15:11:05 +01:00
pg_config Translation updates 2026-02-08 15:11:05 +01:00
pg_controldata Translation updates 2026-02-08 15:11:05 +01:00
pg_ctl Translation updates 2026-02-08 15:11:05 +01:00
pg_dump Translation updates 2026-02-08 15:11:05 +01:00
pg_resetwal Translation updates 2026-02-08 15:11:05 +01:00
pg_rewind Translation updates 2026-02-23 14:06:33 +01:00
pg_test_fsync Translation updates 2026-02-08 15:11:05 +01:00
pg_test_timing Translation updates 2026-02-08 15:11:05 +01:00
pg_upgrade pg_upgrade: Use max_protocol_version=3.0 for older servers 2026-02-24 14:01:58 -08:00
pg_verifybackup Translation updates 2026-02-08 15:11:05 +01:00
pg_waldump Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
pgbench Fix some cases of indirectly casting away const. 2026-02-25 11:19:50 -05:00
pgevent Update copyright for 2021 2021-01-02 13:06:25 -05:00
psql Translation updates 2026-02-08 15:11:05 +01:00
scripts Translation updates 2026-02-08 15:11:05 +01:00
Makefile Add pg_amcheck, a CLI for contrib/amcheck. 2021-03-12 13:00:01 -05:00