diff options
author | ferrieux <ferrieux@users.sourceforge.net> | 2010-03-01 15:14:14 (GMT) |
---|---|---|
committer | ferrieux <ferrieux@users.sourceforge.net> | 2010-03-01 15:14:14 (GMT) |
commit | f36b6da9afedb7fe742ebd593ca37066d622a53f (patch) | |
tree | 80b30b4832ce0a15db323a324d7ce9dbc30d3408 /unix/tclUnixChan.c | |
parent | 298c4065cae4ab2fa1cf1c5a20eb5ee52530bc5a (diff) | |
download | tcl-f36b6da9afedb7fe742ebd593ca37066d622a53f.zip tcl-f36b6da9afedb7fe742ebd593ca37066d622a53f.tar.gz tcl-f36b6da9afedb7fe742ebd593ca37066d622a53f.tar.bz2 |
[Backported] Refrain from a possibly lengthy reverse-DNS lookup on 0.0.0.0 when
calling [fconfigure -sockname] on an universally-bound (default)
server socket.
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r-- | unix/tclUnixChan.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 01d4005..943e924 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.93.2.3 2009/07/16 20:50:54 dgp Exp $ + * RCS: @(#) $Id: tclUnixChan.c,v 1.93.2.4 2010/03/01 15:14:15 ferrieux Exp $ */ #include "tclInt.h" /* Internal definitions for Tcl. */ @@ -2138,9 +2138,13 @@ TcpGetOptionProc( Tcl_DStringStartSublist(dsPtr); } Tcl_DStringAppendElement(dsPtr, inet_ntoa(sockname.sin_addr)); - hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */ - (char *) &sockname.sin_addr, - sizeof(sockname.sin_addr), AF_INET); + if (sockname.sin_addr.s_addr == INADDR_ANY) { + hostEntPtr = NULL; /* we don't want to resolve INADDR_ANY */ + } else { + hostEntPtr = TclpGetHostByAddr( /* INTL: Native. */ + (char *) &sockname.sin_addr, + sizeof(sockname.sin_addr), AF_INET); + } if (hostEntPtr != NULL) { Tcl_DString ds; @@ -3192,5 +3196,7 @@ FileTruncateProc( * mode: c * c-basic-offset: 4 * fill-column: 78 + * tab-width: 8 + * indent-tabs-mode: nil * End: */ |