pgsql: Use printf's %m format instead of strerror(errno) in more places

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use printf's %m format instead of strerror(errno) in more places
Date: 2024-03-12 01:05:04
Message-ID: E1rjqZk-003LPI-3M@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use printf's %m format instead of strerror(errno) in more places

Most callers of strerror() are removed from the backend code. The
remaining callers require special handling with a saved errno from a
previous system call. The frontend code still needs strerror() where
error states need to be handled outside of fprintf.

Note that pg_regress is not changed to use %m as the TAP output may
clobber errno, since those functions call fprintf() and friends before
evaluating the format string.

Support for %m in src/port/snprintf.c has been added in d6c55de1f99a,
hence all the stable branches currently supported include it.

Author: Dagfinn Ilmari Mannsåker
Discussion: https://postgr.es/m/87sf13jhuw.fsf@wibble.ilmari.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2c8118ee5d980e11f73683fcda2329c323aa381e

Modified Files
--------------
src/backend/postmaster/postmaster.c | 21 +++--
src/backend/postmaster/syslogger.c | 2 +-
src/backend/utils/misc/guc.c | 9 +--
src/bin/initdb/findtimezone.c | 4 +-
src/bin/pg_ctl/pg_ctl.c | 74 +++++++++---------
src/bin/pg_dump/compress_gzip.c | 2 +-
src/bin/pg_dump/compress_none.c | 5 +-
src/bin/pg_upgrade/check.c | 41 ++++------
src/bin/pg_upgrade/controldata.c | 6 +-
src/bin/pg_upgrade/exec.c | 14 ++--
src/bin/pg_upgrade/file.c | 98 ++++++++++++------------
src/bin/pg_upgrade/function.c | 3 +-
src/bin/pg_upgrade/option.c | 10 +--
src/bin/pg_upgrade/parallel.c | 12 +--
src/bin/pg_upgrade/pg_upgrade.c | 4 +-
src/bin/pg_upgrade/relfilenumber.c | 5 +-
src/bin/pg_upgrade/tablespace.c | 4 +-
src/bin/pg_upgrade/version.c | 9 +--
src/common/psprintf.c | 4 +-
src/interfaces/ecpg/preproc/ecpg.c | 12 +--
src/port/path.c | 3 +-
src/test/isolation/isolationtester.c | 2 +-
src/test/modules/libpq_pipeline/libpq_pipeline.c | 4 +-
src/tools/ifaddrs/test_ifaddrs.c | 2 +-
24 files changed, 158 insertions(+), 192 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2024-03-12 05:07:53 pgsql: Remove redundant fetch of the recent flush pointer in WalSndWait
Previous Message Jeff Davis 2024-03-12 00:10:32 Re: pgsql: Catalog changes preparing for builtin collation provider.