From 5c40e7c41ee1944f2b2eafb499128fba7a467b17 Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Tue, 7 Sep 1999 18:46:25 +0000 Subject: [PATCH] Add thread-safety notice here. The solution is using gethostbyname_r, but it seems that it takes different parameters on Solaris and Linux. ;-P We should probably make a wrapper function, and make a configure test that checks if there is a reentrant version available, and if not protect gethostbyname and similar calls with a mutex until the results have been copied. Ugly. --- ext/standard/fsock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 3a653af83f..dd353a3ce2 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -131,6 +131,7 @@ int lookup_hostname(const char *addr, struct in_addr *in) struct hostent *host_info; if (!inet_aton(addr, in)) { + /* XXX NOT THREAD SAFE */ host_info = gethostbyname(addr); if (host_info == 0) { /* Error: unknown host */ -- 2.40.0