From: Philip Homburg Date: Fri, 24 Mar 2006 14:07:42 +0000 (+0000) Subject: Added SO_ERROR support for tcp sockets. X-Git-Tag: v3.1.2a~153 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.named-checkzone.html?a=commitdiff_plain;h=e6dbd5cabf92faee0d71665e5f4d77ee55b2935f;p=minix.git Added SO_ERROR support for tcp sockets. --- diff --git a/lib/ip/getsockopt.c b/lib/ip/getsockopt.c index 537e0c945..f72106264 100644 --- a/lib/ip/getsockopt.c +++ b/lib/ip/getsockopt.c @@ -61,7 +61,7 @@ int getsockopt(int socket, int level, int option_name, static int _tcp_getsockopt(int socket, int level, int option_name, void *_RESTRICT option_value, socklen_t *_RESTRICT option_len) { - int i; + int i, r, err; if (level == SOL_SOCKET && option_name == SO_KEEPALIVE) { @@ -73,6 +73,18 @@ static int _tcp_getsockopt(int socket, int level, int option_name, *option_len= sizeof(i); return 0; } + if (level == SOL_SOCKET && option_name == SO_ERROR) + { + r= ioctl(socket, NWIOTCPGERROR, &err); + if (r != 0) + return r; + if (*option_len < sizeof(err)) + memcpy(option_value, &err, *option_len); + else + memcpy(option_value, &err, sizeof(err)); + *option_len= sizeof(err); + return 0; + } if (level == SOL_SOCKET && option_name == SO_RCVBUF) { i= 32*1024; /* Receive buffer in the current