summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authormax <max@tclers.tk>2012-06-22 15:25:24 (GMT)
committermax <max@tclers.tk>2012-06-22 15:25:24 (GMT)
commit5a8367e149f598717dab86e248272257f4517f04 (patch)
tree5a0211bba7ea00dcd0859e0f68639c2ecd9d8d99 /win
parent52c7ab0373f510018f799d3937d4ced51b2a481e (diff)
downloadtcl-5a8367e149f598717dab86e248272257f4517f04.zip
tcl-5a8367e149f598717dab86e248272257f4517f04.tar.gz
tcl-5a8367e149f598717dab86e248272257f4517f04.tar.bz2
Rework the error message generation of [socket], so that the error
code of getaddrinfo is used instead of errno unless it is EAI_SYSTEM.
Diffstat (limited to 'win')
-rw-r--r--win/tclWinSock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index f0c2251..166fdfd 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -1280,9 +1280,14 @@ CreateSocket(
}
if (interp != NULL) {
- Tcl_AppendResult(interp, "couldn't open socket: ",
- Tcl_PosixError(interp), NULL);
+ Tcl_AppendResult(interp, "couldn't open socket: ", NULL);
+ if (errorMsg == NULL) {
+ Tcl_AppendResult(interp, Tcl_PosixError(interp), NULL);
+ } else {
+ Tcl_AppendResult(interp, errorMsg, NULL);
+ }
}
+
if (sock != INVALID_SOCKET) {
closesocket(sock);
}