summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixChan.c
diff options
context:
space:
mode:
authorstanton <stanton>1999-02-03 00:51:19 (GMT)
committerstanton <stanton>1999-02-03 00:51:19 (GMT)
commitd302d0e71085efc1f3c7d150e571cd9bb1901600 (patch)
tree046fb0eda048d3c0c480c5401841aeb295469df9 /unix/tclUnixChan.c
parentbfede94fa75c69f6d063f4eca7c4b2fe9d74bb64 (diff)
downloadtcl-d302d0e71085efc1f3c7d150e571cd9bb1901600.zip
tcl-d302d0e71085efc1f3c7d150e571cd9bb1901600.tar.gz
tcl-d302d0e71085efc1f3c7d150e571cd9bb1901600.tar.bz2
* unix/tclUnixChan.c:
* win/tclWinSock.c: * doc/socket.n: Applied Gordon Chaffee's patch to handle failures during asynchronous socket connection operations. This adds a new "-error" fconfgure option to socket channels. [Bug: 893]
Diffstat (limited to 'unix/tclUnixChan.c')
-rw-r--r--unix/tclUnixChan.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c
index 4fe0144..2759a41 100644
--- a/unix/tclUnixChan.c
+++ b/unix/tclUnixChan.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixChan.c,v 1.8 1999/01/04 19:25:04 rjohnson Exp $
+ * RCS: @(#) $Id: tclUnixChan.c,v 1.9 1999/02/03 00:51:20 stanton Exp $
*/
#include "tclInt.h" /* Internal definitions for Tcl. */
@@ -1659,6 +1659,23 @@ TcpGetOptionProc(instanceData, interp, optionName, dsPtr)
len = strlen(optionName);
}
+ if ((len > 1) && (optionName[1] == 'e') &&
+ (strncmp(optionName, "-error", len) == 0)) {
+ int optlen;
+ int err, ret;
+
+ optlen = sizeof(int);
+ ret = getsockopt(statePtr->fd, SOL_SOCKET, SO_ERROR,
+ (char *)&err, &optlen);
+ if (ret < 0) {
+ err = errno;
+ }
+ if (err != 0) {
+ Tcl_DStringAppend(dsPtr, Tcl_ErrnoMsg(err), -1);
+ }
+ return TCL_OK;
+ }
+
if ((len == 0) ||
((len > 1) && (optionName[1] == 'p') &&
(strncmp(optionName, "-peername", len) == 0))) {