summaryrefslogtreecommitdiff
path: root/win32/win32sck.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32sck.c')
-rw-r--r--win32/win32sck.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/win32/win32sck.c b/win32/win32sck.c
index 670bcf424d..64d1a0a65c 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -57,7 +57,16 @@ static struct servent* win32_savecopyservent(struct servent*d,
struct servent*s,
const char *proto);
+#ifdef USE_THREADS
+#ifdef USE_DECLSPEC_THREAD
__declspec(thread) struct servent myservent;
+#else
+#define myservent (thr->i.Wservent)
+#endif
+#else
+static struct servent myservent;
+#endif
+
static int wsock_started = 0;
void
@@ -435,7 +444,8 @@ struct servent *
win32_getservbyname(const char *name, const char *proto)
{
struct servent *r;
-
+ dTHR;
+
SOCKET_TEST(r = getservbyname(name, proto), NULL);
if (r) {
r = win32_savecopyservent(&myservent, r, proto);
@@ -447,6 +457,7 @@ struct servent *
win32_getservbyport(int port, const char *proto)
{
struct servent *r;
+ dTHR;
SOCKET_TEST(r = getservbyport(port, proto), NULL);
if (r) {