From 92f57d003c5145e550c43eb119f6e2ba4bafe9c2 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Thu, 19 Feb 1998 19:38:20 +0000 Subject: [PATCH] Revert sosend() to its behavior from 4.3-Tahoe and before: if so_error is set, clear it before returning it. The behavior introduced in 4.3-Reno (to not clear so_error) causes potentially transient errors (e.g. ECONNREFUSED if the other end hasn't opened its socket yet) to be permanent on connected datagram sockets that are only used for writing. (soreceive() clears so_error before returning it, as does getsockopt(...,SO_ERROR,...).) Submitted by: Van Jacobson , via a comment in the vat sources. --- sys/kern/uipc_socket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f34f9b698471..72897dbfd611 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 - * $Id: uipc_socket.c,v 1.35 1998/02/04 22:32:37 eivind Exp $ + * $Id: uipc_socket.c,v 1.36 1998/02/06 12:13:28 eivind Exp $ */ #include @@ -384,8 +384,12 @@ restart: s = splnet(); if (so->so_state & SS_CANTSENDMORE) snderr(EPIPE); - if (so->so_error) - snderr(so->so_error); + if (so->so_error) { + error = so->so_error; + so->so_error = 0; + splx(s); + goto release; + } if ((so->so_state & SS_ISCONNECTED) == 0) { /* * `sendto' and `sendmsg' is allowed on a connection-