Change uipc_sockaddr so that a sockaddr_un without a path is returned

nam for an unbound socket instead of leaving nam untouched in that case.
This way, the getsockname() output can be used to determine the address
family of such sockets (AF_LOCAL).

Reviewed by:	iedowse
Approved by:	rwatson
This commit is contained in:
Thomas Moestl 2001-04-24 19:09:23 +00:00
parent c7e1887023
commit 83f3198b2b

View File

@ -420,6 +420,8 @@ uipc_sockaddr(struct socket *so, struct sockaddr **nam)
return EINVAL;
if (unp->unp_addr)
*nam = dup_sockaddr((struct sockaddr *)unp->unp_addr, 1);
else
*nam = dup_sockaddr((struct sockaddr *)&sun_noname, 1);
return 0;
}