From 26e9d4d4ef16b5e2be96319f89ea6ba7f63a4d73 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 26 Sep 2018 11:06:42 -0400 Subject: 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 --- src/pl/plpython/plpython.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/pl/plpython/plpython.h') diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index 5c2e6a83f30..6cc323a568d 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -27,7 +27,6 @@ */ #undef _POSIX_C_SOURCE #undef _XOPEN_SOURCE -#undef HAVE_STRERROR #undef HAVE_TZNAME /* -- cgit v1.2.3