You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Convert elog.c's useful_strerror() into a globally-used strerror wrapper.
elog.c has long had a private strerror wrapper that handles assortedpossible failures or deficiencies of the platform's strerror. On Windows,it also knows how to translate Winsock error codes, which the nativestrerror does not. Move all this code into src/port/strerror.c anddefine strerror() as a macro that invokes it, so that both our frontendand backend code will have all of this behavior.I believe this constitutes an actual bug fix on Windows, since AFAICSour frontend code did not report Winsock error codes properly before this.However, the main point is to lay the groundwork for implementing %min 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'sbeen dead code for nigh twenty years now, since strerror() wasalready required by C89.We should likewise cause strerror_r to use this behavior, butI'll tackle that separately.Patch by me, reviewed by Michael PaquierDiscussion:https://postgr.es/m/2975.1526862605@sss.pgh.pa.us