2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Explain <isc/strerr.h> a little more

The purpose of the `strerror_r()` wrapper was not obvious.
This commit is contained in:
Tony Finch 2022-12-16 13:30:39 +00:00
parent fe8e7e5958
commit b0893ae09a
3 changed files with 15 additions and 5 deletions

View File

@ -1,3 +1,6 @@
6101. [port] Clarify the portability dodge needed for `strerror_r()`
[GL !7465]
6100. [cleanup] Deprecate <isc/deprecated.h>, because obsolete
functions are now deleted instead of marked with
an attribute. [GL !7466]

View File

@ -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

View File

@ -55,6 +55,14 @@
#include <isc/string.h> /* 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));
}