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)
commitffda352cbe3ef13481ae52a01a3da337ad3778fc (patch)
tree5a0211bba7ea00dcd0859e0f68639c2ecd9d8d99 /win
parent90e7d603fcf06a4c1c35ebde8e4ddf74134d5844 (diff)
downloadtcl-ffda352cbe3ef13481ae52a01a3da337ad3778fc.zip
tcl-ffda352cbe3ef13481ae52a01a3da337ad3778fc.tar.gz
tcl-ffda352cbe3ef13481ae52a01a3da337ad3778fc.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);
}