summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixSock.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-07-01 19:51:28 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-07-01 19:51:28 (GMT)
commit7747ac024f699006066d1eb7919fab3f7715d835 (patch)
tree14e48d160d21d4a4b84a7a47545b914f6f1962c0 /unix/tclUnixSock.c
parent24ce75e998f13506548f2bebeb361405aa16546f (diff)
parenta01324b87773322006055cac9ff0da9bdae34d4b (diff)
downloadtcl-7747ac024f699006066d1eb7919fab3f7715d835.zip
tcl-7747ac024f699006066d1eb7919fab3f7715d835.tar.gz
tcl-7747ac024f699006066d1eb7919fab3f7715d835.tar.bz2
merge trunk
Diffstat (limited to 'unix/tclUnixSock.c')
-rw-r--r--unix/tclUnixSock.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 12e5a9a..1e9d4eb 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -1117,11 +1117,7 @@ Tcl_OpenTcpClient(
freeaddrinfo(addrlist);
}
if (interp != NULL) {
- Tcl_AppendResult(interp, "couldn't open socket: ",
- Tcl_PosixError(interp), NULL);
- if (errorMsg != NULL) {
- Tcl_AppendResult(interp, " (", errorMsg, ")", NULL);
- }
+ Tcl_AppendResult(interp, "couldn't open socket: ", errorMsg, NULL);
}
return NULL;
}
@@ -1261,10 +1257,11 @@ Tcl_OpenTcpServer(
* Try to record and return the most meaningful error message, i.e. the
* one from the first socket that went the farthest before it failed.
*/
- enum { START, SOCKET, BIND, LISTEN } howfar = START;
+ enum { LOOKUP, SOCKET, BIND, LISTEN } howfar = LOOKUP;
int my_errno = 0;
if (!TclCreateSocketAddress(interp, &addrlist, myHost, port, 1, &errorMsg)) {
+ my_errno = errno;
goto error;
}
@@ -1392,11 +1389,12 @@ Tcl_OpenTcpServer(
return statePtr->channel;
}
if (interp != NULL) {
- errno = my_errno;
- Tcl_AppendResult(interp, "couldn't open socket: ",
- Tcl_PosixError(interp), NULL);
- if (errorMsg != NULL) {
- Tcl_AppendResult(interp, " (", errorMsg, ")", NULL);
+ Tcl_AppendResult(interp, "couldn't open socket: ", NULL);
+ if (errorMsg == NULL) {
+ errno = my_errno;
+ Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL);
+ } else {
+ Tcl_AppendResult(interp, errorMsg, NULL);
}
}
if (sock != -1) {