diff options
author | max <max@tclers.tk> | 2012-06-22 15:25:24 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2012-06-22 15:25:24 (GMT) |
commit | ffda352cbe3ef13481ae52a01a3da337ad3778fc (patch) | |
tree | 5a0211bba7ea00dcd0859e0f68639c2ecd9d8d99 /generic/tclIOSock.c | |
parent | 90e7d603fcf06a4c1c35ebde8e4ddf74134d5844 (diff) | |
download | tcl-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 'generic/tclIOSock.c')
-rw-r--r-- | generic/tclIOSock.c | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 89d6c02..6a7be7e 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -206,7 +206,10 @@ TclCreateSocketAddress( } if (result != 0) { - goto error; + if (result != EAI_SYSTEM) { + *errorMsgPtr = gai_strerror(result); + } + return 0; } /* @@ -249,33 +252,6 @@ TclCreateSocketAddress( } return 1; - - /* - * Ought to use gai_strerror() here... - */ - -error: - switch (result) { - case EAI_NONAME: - case EAI_SERVICE: -#if defined(EAI_ADDRFAMILY) && EAI_ADDRFAMILY != EAI_NONAME - case EAI_ADDRFAMILY: -#endif -#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME - case EAI_NODATA: -#endif - *errorMsgPtr = gai_strerror(result); - errno = EHOSTUNREACH; - return 0; -#ifdef EAI_SYSTEM - case EAI_SYSTEM: - return 0; -#endif - default: - *errorMsgPtr = gai_strerror(result); - errno = ENXIO; - return 0; - } } /* |