summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authorvasiljevic <zv@archiware.com>2006-09-06 13:23:36 (GMT)
committervasiljevic <zv@archiware.com>2006-09-06 13:23:36 (GMT)
commit799d39d3b8d26226e0e4daff3204b791a2d892c6 (patch)
tree2771d0bedc880175f4b3d2c6e27a3cec726604a3 /unix/tclUnixSock.c
parent074d20bb308981e3f28eff4662c43e9308f5b4ca (diff)
downloadtcl-799d39d3b8d26226e0e4daff3204b791a2d892c6.zip
tcl-799d39d3b8d26226e0e4daff3204b791a2d892c6.tar.gz
tcl-799d39d3b8d26226e0e4daff3204b791a2d892c6.tar.bz2
Added fixes for Tcl Bug 999544 (ported from core-8-4-branch).
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r--unix/tclUnixSock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index df39753..961110e 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixSock.c,v 1.15 2006/03/10 17:33:24 vasiljevic Exp $
+ * RCS: @(#) $Id: tclUnixSock.c,v 1.16 2006/09/06 13:23:37 vasiljevic Exp $
*/
#include "tclInt.h"
@@ -43,6 +43,11 @@ InitializeHostName(
Tcl_Encoding *encodingPtr)
{
CONST char *native = NULL;
+#ifdef TCL_THREADS
+ int buflen = 1024, herrno;
+ char buf[1024];
+ struct hostent he;
+#endif
#ifndef NO_UNAME
struct utsname u;
@@ -50,7 +55,12 @@ InitializeHostName(
(void *) memset((void *) &u, (int) 0, sizeof(struct utsname));
if (uname(&u) > -1) { /* INTL: Native. */
+#ifdef TCL_THREADS
+ hp = TclpGetHostByName( /* INTL: Native. */
+ u.nodename, &he, buf, buflen, &herrno);
+#else
hp = gethostbyname(u.nodename); /* INTL: Native. */
+#endif
if (hp == NULL) {
/*
* Sometimes the nodename is fully qualified, but gets truncated
@@ -65,7 +75,11 @@ InitializeHostName(
memcpy(node, u.nodename, (size_t) (dot - u.nodename));
node[dot - u.nodename] = '\0';
+#ifdef TCL_THREADS
+ hp = TclpGetHostByName(node, &he, buf, buflen, &herrno);
+#else
hp = gethostbyname(node);
+#endif
ckfree(node);
}
}