summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-07-24 13:43:13 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-07-24 13:43:13 (GMT)
commit7bef47d44562d1078457fd681f39a40e54d43897 (patch)
treef79b79c18af72508f50fcae2f30fb737d32e5ea9 /win
parentf59647e5c6c248949d3a847fa293c5888c53f023 (diff)
downloadtcl-7bef47d44562d1078457fd681f39a40e54d43897.zip
tcl-7bef47d44562d1078457fd681f39a40e54d43897.tar.gz
tcl-7bef47d44562d1078457fd681f39a40e54d43897.tar.bz2
* win/tclWinSock.c: Correct un-initialized Tcl_DString. Thanks
to afredd. [Bug 1518166]
Diffstat (limited to 'win')
-rw-r--r--win/tclWinSock.c32
1 files changed, 17 insertions, 15 deletions
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)));
+ }
}
}