From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert elog.c's useful_strerror() into a globally-used strerror
Date: Wed, 26 Sep 2018 15:06:53 +0000
Message-ID: <E1g5BOv-00036T-U1@gemulon.postgresql.org> (raw)
Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
elog.c has long had a private strerror wrapper that handles assorted
possible failures or deficiencies of the platform's strerror. On Windows,
it also knows how to translate Winsock error codes, which the native
strerror does not. Move all this code into src/port/strerror.c and
define strerror() as a macro that invokes it, so that both our frontend
and backend code will have all of this behavior.
I believe this constitutes an actual bug fix on Windows, since AFAICS
our frontend code did not report Winsock error codes properly before this.
However, the main point is to lay the groundwork for implementing %m
in src/port/snprintf.c: the behavior we want %m to have is this one,
not the native strerror's.
Note that this throws away the prior use of src/port/strerror.c,
which was to implement strerror() on platforms lacking it. That's
been dead code for nigh twenty years now, since strerror() was
already required by C89.
We should likewise cause strerror_r to use this behavior, but
I'll tackle that separately.
Patch by me, reviewed by Michael Paquier
Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/26e9d4d4ef16b5e2be96319f89ea6ba7f63a4d73
Modified Files
--------------
configure | 13 --
configure.in | 2 +-
src/backend/port/win32/socket.c | 36 ----
src/backend/utils/error/elog.c | 217 +---------------------
src/include/pg_config.h.in | 3 -
src/include/pg_config.h.win32 | 5 -
src/include/port.h | 8 +-
src/include/port/win32_port.h | 6 +-
src/interfaces/ecpg/compatlib/.gitignore | 1 +
src/interfaces/ecpg/compatlib/Makefile | 6 +-
src/interfaces/ecpg/ecpglib/.gitignore | 1 +
src/interfaces/ecpg/ecpglib/Makefile | 6 +-
src/interfaces/ecpg/pgtypeslib/.gitignore | 1 +
src/interfaces/ecpg/pgtypeslib/Makefile | 6 +-
src/interfaces/libpq/Makefile | 4 +-
src/pl/plpython/plpython.h | 1 -
src/port/Makefile | 2 +-
src/port/strerror.c | 289 ++++++++++++++++++++++++++++--
src/tools/msvc/Mkvcbuild.pm | 3 +-
19 files changed, 299 insertions(+), 311 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Convert elog.c's useful_strerror() into a globally-used strerror
In-Reply-To: <E1g5BOv-00036T-U1@gemulon.postgresql.org>
References: <E1g5BOv-00036T-U1@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