From: Tony Finch Date: Fri, 16 Dec 2022 13:30:39 +0000 (+0000) Subject: Explain a little more X-Git-Tag: v9.19.11~62^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0893ae09a6eb74e0f7e06b3da515d735ed7b323;p=thirdparty%2Fbind9.git Explain a little more The purpose of the `strerror_r()` wrapper was not obvious. --- diff --git a/CHANGES b/CHANGES index 270f9c7cb08..63ec91928f1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +6101. [port] Clarify the portability dodge needed for `strerror_r()` + [GL !7465] + 6100. [cleanup] Deprecate , because obsolete functions are now deleted instead of marked with an attribute. [GL !7466] diff --git a/lib/isc/include/isc/strerr.h b/lib/isc/include/isc/strerr.h index 563ff48283e..61f1c526a6d 100644 --- a/lib/isc/include/isc/strerr.h +++ b/lib/isc/include/isc/strerr.h @@ -26,4 +26,8 @@ #if defined(strerror_r) #undef strerror_r #endif /* if defined(strerror_r) */ + +/* + * Ensure we use a consistent implementation of strerror_r() + */ #define strerror_r isc_string_strerror_r diff --git a/lib/isc/string.c b/lib/isc/string.c index 09cf5d636c1..7603ac2b25e 100644 --- a/lib/isc/string.c +++ b/lib/isc/string.c @@ -55,6 +55,14 @@ #include /* IWYU pragma: keep */ +/* + * We undef _GNU_SOURCE above to get the POSIX strerror_r() + */ +int +isc_string_strerror_r(int errnum, char *buf, size_t buflen) { + return (strerror_r(errnum, buf, buflen)); +} + #if !defined(HAVE_STRLCPY) size_t strlcpy(char *dst, const char *src, size_t size) { @@ -136,8 +144,3 @@ strnstr(const char *s, const char *find, size_t slen) { return ((char *)s); } #endif - -int -isc_string_strerror_r(int errnum, char *buf, size_t buflen) { - return (strerror_r(errnum, buf, buflen)); -}