Let listen() return EDESTADDRREQ when not bound.
We currently return EINVAL when calling listen() on a UNIX socket that has not been bound to a pathname. If my interpretation of POSIX is correct, we should return EDESTADDRREQ: "The socket is not bound to a local address, and the protocol does not support listening on an unbound socket." Return EDESTADDRREQ instead when not bound and not connected. Differential Revision: https://reviews.freebsd.org/D3038 Reviewed by: gnn, network
This commit is contained in:
parent
847bf38369
commit
47a84387ad
@ -736,8 +736,10 @@ uipc_listen(struct socket *so, int backlog, struct thread *td)
|
||||
|
||||
UNP_PCB_LOCK(unp);
|
||||
if (unp->unp_vnode == NULL) {
|
||||
/* Already connected or not bound to an address. */
|
||||
error = unp->unp_conn != NULL ? EINVAL : EDESTADDRREQ;
|
||||
UNP_PCB_UNLOCK(unp);
|
||||
return (EINVAL);
|
||||
return (error);
|
||||
}
|
||||
|
||||
SOCK_LOCK(so);
|
||||
|
Loading…
x
Reference in New Issue
Block a user