From 402cc72db6cdccbdd4e6e0bdf60140bf2354bf4f Mon Sep 17 00:00:00 2001 From: David Greenman Date: Wed, 15 Feb 1995 11:30:35 +0000 Subject: [PATCH] Fixed bug caused by attempting a connect with a null 'nam'. --- sys/kern/uipc_usrreq.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index b856fee7e52..41116de0150 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 - * $Id: uipc_usrreq.c,v 1.5 1994/10/02 17:35:36 phk Exp $ + * $Id: uipc_usrreq.c,v 1.6 1995/02/07 02:01:16 wollman Exp $ */ #include @@ -216,12 +216,19 @@ uipc_usrreq(so, req, m, nam, control) /* Connect if not connected yet. */ /* * Note: A better implementation would complain - * if already connected, nam non-zero and not - * equal to the peer's address. + * if not equal to the peer's address. */ - if ((so->so_state & SS_ISCONNECTED) == 0 && - (error = unp_connect(so, nam, p)) != 0) - break; /* XXX */ + if ((so->so_state & SS_ISCONNECTED) == 0) { + if (nam) { + error = unp_connect(so, nam, p); + if (error) + break; /* XXX */ + } else { + error = ENOTCONN; + break; + } + } + if (so->so_state & SS_CANTSENDMORE) { error = EPIPE; break;