Fix implementation of sock_getname.
MFC after: 1 week
This commit is contained in:
parent
ce7707b487
commit
f336c6303e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254734
@ -44,7 +44,7 @@ static inline int
|
||||
sock_getname(struct socket *so, struct sockaddr *addr, int *sockaddr_len,
|
||||
int peer)
|
||||
{
|
||||
struct sockaddr **nam;
|
||||
struct sockaddr *nam;
|
||||
int error;
|
||||
|
||||
nam = NULL;
|
||||
@ -52,15 +52,15 @@ sock_getname(struct socket *so, struct sockaddr *addr, int *sockaddr_len,
|
||||
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0)
|
||||
return (-ENOTCONN);
|
||||
|
||||
error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, nam);
|
||||
error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &nam);
|
||||
} else
|
||||
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, nam);
|
||||
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &nam);
|
||||
if (error)
|
||||
return (-error);
|
||||
*addr = **nam;
|
||||
*addr = *nam;
|
||||
*sockaddr_len = addr->sa_len;
|
||||
|
||||
free(*nam, M_SONAME);
|
||||
free(nam, M_SONAME);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user