pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use printf's %m format instead of strerror(errno) in more places
Date: Tue, 12 Mar 2024 01:05:04 +0000
Message-ID: <E1rjqZk-003LPI-3M@gemulon.postgresql.org> (raw)

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(-)



view thread (2+ messages)

Message-ID: <E1rjqZk-003LPI-3M@gemulon.postgresql.org>
Permalink:  ../E1rjqZk-003LPI-3M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rjqZk-003LPI-3M@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use printf's %m format instead of strerror(errno) in more places
  In-Reply-To: <E1rjqZk-003LPI-3M@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox