Skip to content

Commit 74b027e

Browse files
NattyNarwhalkkloberdanz
authored andcommitted
AIX has a glibc-compatible strerror_r w/ diff name
The AIX strerror_r doesn't have the same semantics as glibc's (diff type signature), but it does provide one under a different name. This name is used if you use -D_LINUX_SOURCE_COMPAT, but it's a big hammer. We can just use it directly.
1 parent a22bb06 commit 74b027e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libbson/src/bson/bson-error.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ bson_strerror_r (int err_code, /* IN */
116116
if (strerror_s (buf, buflen, err_code) != 0) {
117117
ret = buf;
118118
}
119+
#elif defined(_AIX)
120+
// AIX does not provide strerror_l, and its strerror_r isn't glibc's.
121+
// But it does provide a glibc compatible one called __linux_strerror_r
122+
ret = __linux_strerror_r (err_code, buf, buflen);
119123
#elif defined(__APPLE__)
120124
// Apple does not provide `strerror_l`, but it does unconditionally provide
121125
// the XSI-compliant `strerror_r`, but only when compiling with Apple Clang.

0 commit comments

Comments
 (0)