cvs: /php4/ext/standard fsock.c
| From: | Stig Bakken | Date: | Tue, 07 Sep 1999 18:46:26 +0000 |
| Subject: | cvs: /php4/ext/standard fsock.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-4208@lists.php.net to get a copy of this message | ||
ssb Tue Sep 7 14:46:26 1999 EDT
Modified files:
/php4/ext/standard fsock.c
Log:
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.
Index: php4/ext/standard/fsock.c
diff -u php4/ext/standard/fsock.c:1.22 php4/ext/standard/fsock.c:1.23
--- php4/ext/standard/fsock.c:1.22 Wed Aug 25 12:24:13 1999
+++ php4/ext/standard/fsock.c Tue Sep 7 14:46:25 1999
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: fsock.c,v 1.22 1999/08/25 16:24:13 andi Exp $ */
+/* $Id: fsock.c,v 1.23 1999/09/07 18:46:25 ssb Exp $ */
/* Synced with php3 revision 1.121 1999-06-18 [ssb] */
/* Synced with php3 revision 1.133 1999-07-21 [sas] */
@@ -131,6 +131,7 @@
struct hostent *host_info;
if (!inet_aton(addr, in)) {
+ /* XXX NOT THREAD SAFE */
host_info = gethostbyname(addr);
if (host_info == 0) {
/* Error: unknown host */