diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win/tclWinSock.c | 32 |
2 files changed, 23 insertions, 15 deletions
@@ -1,4 +1,10 @@ +2006-07-24 Don Porter <dgp@users.sourceforge.net> + + * win/tclWinSock.c: Correct un-initialized Tcl_DString. Thanks + to afredd. [Bug 1518166] + 2006-07-21 Miguel Sofer <msofer@users.sf.net> + * generic/tclExecute.c: * tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803]. diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 488618d..717b42a 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.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: tclWinSock.c,v 1.54 2006/04/05 16:32:45 dgp Exp $ + * RCS: @(#) $Id: tclWinSock.c,v 1.55 2006/07/24 13:43:14 dgp Exp $ */ #include "tclWinInt.h" @@ -2551,21 +2551,23 @@ InitializeHostName( Tcl_UtfToLower(Tcl_WinTCharToUtf((TCHAR *) wbuf, -1, &ds)); - } else if (TclpHasSockets(NULL) == TCL_OK) { - /* - * Buffer length of 255 copied slavishly from previous version of this - * routine. Presumably there's a more "correct" macro value for a - * properly sized buffer for a gethostname() call. Maintainers are - * welcome to supply it. - */ - + } else { Tcl_DStringInit(&ds); - Tcl_DStringSetLength(&ds, 255); - if (winSock.gethostname(Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds)) == 0) { - Tcl_DStringSetLength(&ds, 0); - } else { - Tcl_DStringSetLength(&ds, strlen(Tcl_DStringValue(&ds))); + if (TclpHasSockets(NULL) == TCL_OK) { + /* + * Buffer length of 255 copied slavishly from previous version + * of this routine. Presumably there's a more "correct" macro + * value for a properly sized buffer for a gethostname() call. + * Maintainers are welcome to supply it. + */ + + Tcl_DStringSetLength(&ds, 255); + if (winSock.gethostname(Tcl_DStringValue(&ds), + Tcl_DStringLength(&ds)) == 0) { + Tcl_DStringSetLength(&ds, 0); + } else { + Tcl_DStringSetLength(&ds, strlen(Tcl_DStringValue(&ds))); + } } } |