summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-11-19 17:29:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-11-19 17:29:12 (GMT)
commitcc6faa155b3ac525cab5b017159361b62c4a9c6a (patch)
tree7fcee0f1e0eb5fa165d2af2f118b1cd52c6352f8 /unix/tclUnixSock.c
parent274d86b2ec1d33d42ce059946338c6e6e1086ea8 (diff)
parent1fae54c8c004d072d62e3d867ef4e66b238d0bcd (diff)
downloadtcl-cc6faa155b3ac525cab5b017159361b62c4a9c6a.zip
tcl-cc6faa155b3ac525cab5b017159361b62c4a9c6a.tar.gz
tcl-cc6faa155b3ac525cab5b017159361b62c4a9c6a.tar.bz2
merge 8.7
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r--unix/tclUnixSock.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 2793d3b..bd54a2e 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -253,9 +253,6 @@ InitializeHostName(
native = u.nodename;
}
}
- if (native == NULL) {
- native = &tclEmptyString;
- }
#else /* !NO_UNAME */
/*
* Uname doesn't exist; try gethostname instead.
@@ -284,9 +281,15 @@ InitializeHostName(
#endif /* NO_UNAME */
*encodingPtr = Tcl_GetEncoding(NULL, NULL);
- *lengthPtr = strlen(native);
- *valuePtr = ckalloc(*lengthPtr + 1);
- memcpy(*valuePtr, native, *lengthPtr + 1);
+ if (native) {
+ *lengthPtr = strlen(native);
+ *valuePtr = ckalloc(*lengthPtr + 1);
+ memcpy(*valuePtr, native, *lengthPtr + 1);
+ } else {
+ *lengthPtr = 0;
+ *valuePtr = ckalloc(1);
+ *valuePtr[0] = '\0';
+ }
}
/*