diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index 45b13b39e15..96b934a662a 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -19,7 +19,11 @@ extern "C" { +#ifdef NO_TLS int h_errno; +#else +__thread int h_errno; +#endif static hostent __gethostbyname_buffer; static in_addr_t __gethostbyname_address; diff --git a/Userland/Libraries/LibC/netdb.h b/Userland/Libraries/LibC/netdb.h index eec4f3b4969..8fff8cc471b 100644 --- a/Userland/Libraries/LibC/netdb.h +++ b/Userland/Libraries/LibC/netdb.h @@ -48,7 +48,11 @@ struct protoent* getprotobynumber(int proto); struct protoent* getprotoent(void); void setprotoent(int stay_open); +#ifdef NO_TLS extern int h_errno; +#else +extern __thread int h_errno; +#endif #define HOST_NOT_FOUND 101 #define NO_DATA 102