git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: a49ceda) | patch
Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
2018年9月26日 15:06:42 +0000 (11:06 -0400)
2018年9月26日 15:06:42 +0000 (11:06 -0400)
commit 26e9d4d4ef16b5e2be96319f89ea6ba7f63a4d73
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
19 files changed:
configure diff | blob | blame | history
configure.in diff | blob | blame | history
src/backend/port/win32/socket.c diff | blob | blame | history
src/backend/utils/error/elog.c diff | blob | blame | history
src/include/pg_config.h.in diff | blob | blame | history
src/include/pg_config.h.win32 diff | blob | blame | history
src/include/port.h diff | blob | blame | history
src/include/port/win32_port.h diff | blob | blame | history
src/interfaces/ecpg/compatlib/.gitignore diff | blob | blame | history
src/interfaces/ecpg/compatlib/Makefile diff | blob | blame | history
src/interfaces/ecpg/ecpglib/.gitignore diff | blob | blame | history
src/interfaces/ecpg/ecpglib/Makefile diff | blob | blame | history
src/interfaces/ecpg/pgtypeslib/.gitignore diff | blob | blame | history
src/interfaces/ecpg/pgtypeslib/Makefile diff | blob | blame | history
src/interfaces/libpq/Makefile diff | blob | blame | history
src/pl/plpython/plpython.h diff | blob | blame | history
src/port/Makefile diff | blob | blame | history
src/port/strerror.c diff | blob | blame | history
src/tools/msvc/Mkvcbuild.pm diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /