mirror of
git://git.musl-libc.org/musl
synced 2025-01-10 16:49:50 +00:00
restore h_errno ABI compatibility with ancient binaries
prior to commit e68c51ac46
, h_errno was
actually an external data object not a macro. bring back the symbol,
and use it as the storage for the main thread's h_errno.
technically this still doesn't provide full compatibility if the
application was multithreaded, but at the time there were no res_*
functions (and they did not set h_errno anyway), so any use of h_errno
would have been via thread-unsafe functions. thus a solution that just
fixes single-threaded applications seems acceptable.
This commit is contained in:
parent
cab0a8fb8d
commit
cf27184d00
@ -1,7 +1,11 @@
|
||||
#include <netdb.h>
|
||||
#include "pthread_impl.h"
|
||||
|
||||
#undef h_errno
|
||||
int h_errno;
|
||||
|
||||
int *__h_errno_location(void)
|
||||
{
|
||||
if (!__pthread_self()->stack) return &h_errno;
|
||||
return &__pthread_self()->h_errno_val;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user