unix: Be consistent about error handling for unconnected sockets

SOCK_STREAM and SOCK_SEQPACKET sockets should get the same treatment
here.

PR:		176420
MFC after:	2 weeks

(cherry picked from commit 1c933f464f)
This commit is contained in:
Mark Johnston 2025-01-06 22:55:38 +00:00
parent a158d26e89
commit 8373644ee2

View file

@ -1779,7 +1779,7 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt)
if (unp->unp_flags & UNP_HAVEPC)
xu = unp->unp_peercred;
else {
if (so->so_type == SOCK_STREAM)
if (so->so_proto->pr_flags & PR_CONNREQUIRED)
error = ENOTCONN;
else
error = EINVAL;