diff --git a/CHANGES b/CHANGES index 270f9c7cb0..63ec91928f 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 563ff48283..61f1c526a6 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 09cf5d636c..7603ac2b25 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)); -}