Do not use SA_LEN() to dereference sa_len.

FreeBSD lacks the SA_LEN() macro.
This commit is contained in:
Craig Rodrigues 2015-11-16 17:11:11 +00:00
parent 21f6783298
commit 4fa5f53548
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290940

View File

@ -71,14 +71,14 @@ client_aldap_open(struct ypldap_addr *addr)
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
struct sockaddr *sa = (struct sockaddr *)&p->ss;
if (getnameinfo(sa, SA_LEN(sa), hbuf, sizeof(hbuf), sbuf,
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV))
errx(1, "could not get numeric hostname");
if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0)
return NULL;
if (connect(fd, sa, SA_LEN(sa)) == 0)
if (connect(fd, sa, sa->sa_len) == 0)
break;
warn("connect to %s port %s (%s) failed", hbuf, sbuf, "tcp");