diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index d2e45564c09f..be704bf0014f 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1424,6 +1424,8 @@ soshutdown(so, how) if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) return (EINVAL); + if ((so->so_state & SS_ISCONNECTED) == 0) + return (ENOTCONN); if (how != SHUT_WR) sorflush(so);