From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Convert elog.c's useful_strerror() into a globally-used strerror |
Date: | 2018-09-26 15:06:53 |
Message-ID: | E1g5BOv-00036T-U1@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-09-26 16:36:03 | pgsql: Incorporate strerror_r() into src/port/snprintf.c, too. |
Previous Message | Peter Eisentraut | 2018-09-26 11:30:33 | pgsql: Update dummy CREATE ASSERTION grammar |