From dfbac62505d3c818fc2e3a0744a6efdf6110ef6f Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Fri, 16 Dec 2022 13:30:39 +0000 Subject: [PATCH] Explain a little more I tried to delete it, but it isn't as crufty as it appeared to be. --- lib/isc/include/isc/strerr.h | 4 ++++ lib/isc/string.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) 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)); -}