Skip to content

Commit 73873c6

Browse files
authored
Fix glibc incompatibility (#81)
1 parent 4f2fdcd commit 73873c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/glibc_compat.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,11 @@ int pthread_atfork(void (*prepare)(void), void (*parent)(void),
114114
return real_atfork(prepare, parent, child);
115115
}
116116

117+
// the symbol strerror_r in glibc is not the POSIX version; it returns char *
118+
// __xpg_sterror_r is exported by both glibc and musl
119+
int strerror_r(int errnum, char *buf, size_t buflen) {
120+
int __xpg_strerror_r(int, char *, size_t);
121+
return __xpg_strerror_r(errnum, buf, buflen);
122+
}
123+
117124
#endif

0 commit comments

Comments
 (0)