diff options
author | vasiljevic <zv@archiware.com> | 2006-09-06 13:23:36 (GMT) |
---|---|---|
committer | vasiljevic <zv@archiware.com> | 2006-09-06 13:23:36 (GMT) |
commit | 799d39d3b8d26226e0e4daff3204b791a2d892c6 (patch) | |
tree | 2771d0bedc880175f4b3d2c6e27a3cec726604a3 /unix/tclUnixChan.c | |
parent | 074d20bb308981e3f28eff4662c43e9308f5b4ca (diff) | |
download | tcl-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/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 552d819..5a0d40b 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixChan.c,v 1.70 2006/08/18 11:23:22 das Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.71 2006/09/06 13:23:37 vasiljevic Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -2266,14 +2266,25 @@ TcpGetOptionProc( (strncmp(optionName, "-peername", len) == 0))) { if (getpeername(statePtr->fd, (struct sockaddr *) &peername, &size) >= 0) { +#ifdef TCL_THREADS + int buflen = 1024, herrno; + char hbuf[1024]; + struct hostent he; +#endif if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringStartSublist(dsPtr); } Tcl_DStringAppendElement(dsPtr, inet_ntoa(peername.sin_addr)); +#ifdef TCL_THREADS + hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */ + (char *) &peername.sin_addr, sizeof(peername.sin_addr), + AF_INET, &he, hbuf, buflen, &herrno); +#else hostEntPtr = gethostbyaddr( /* INTL: Native. */ (char *) &peername.sin_addr, sizeof(peername.sin_addr), AF_INET); +#endif if (hostEntPtr != NULL) { Tcl_DString ds; @@ -2313,14 +2324,25 @@ TcpGetOptionProc( (strncmp(optionName, "-sockname", len) == 0))) { if (getsockname(statePtr->fd, (struct sockaddr *) &sockname, &size) >= 0) { +#ifdef TCL_THREADS + int buflen = 1024, herrno; + char hbuf[1024]; + struct hostent he; +#endif if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } Tcl_DStringAppendElement(dsPtr, inet_ntoa(sockname.sin_addr)); +#ifdef TCL_THREADS + hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */ + (char *) &sockname.sin_addr, sizeof(sockname.sin_addr), + AF_INET, &he, hbuf, buflen, &herrno); +#else hostEntPtr = gethostbyaddr( /* INTL: Native. */ (char *) &sockname.sin_addr, sizeof(sockname.sin_addr), AF_INET); +#endif if (hostEntPtr != NULL) { Tcl_DString ds; |