mirror of https://github.com/mkerrisk/man-pages
Remove mention of sa_len field from example code.
That field is a BSDism not present on Linux.
This commit is contained in:
parent
cd117d4875
commit
481c58cae6
|
@ -221,9 +221,10 @@ a particular address family.
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct sockaddr *sa; /* input */
|
struct sockaddr *sa; /* input */
|
||||||
|
socklent_t len; /* input */
|
||||||
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
||||||
|
|
||||||
if (getnameinfo(sa, sa\->sa_len, hbuf, sizeof(hbuf), sbuf,
|
if (getnameinfo(sa, len, hbuf, sizeof(hbuf), sbuf,
|
||||||
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0)
|
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0)
|
||||||
printf("host=%s, serv=%s\en", hbuf, sbuf);
|
printf("host=%s, serv=%s\en", hbuf, sbuf);
|
||||||
.fi
|
.fi
|
||||||
|
@ -235,9 +236,10 @@ reverse address mapping.
|
||||||
.in +4n
|
.in +4n
|
||||||
.nf
|
.nf
|
||||||
struct sockaddr *sa; /* input */
|
struct sockaddr *sa; /* input */
|
||||||
|
socklent_t len; /* input */
|
||||||
char hbuf[NI_MAXHOST];
|
char hbuf[NI_MAXHOST];
|
||||||
|
|
||||||
if (getnameinfo(sa, sa\->sa_len, hbuf, sizeof(hbuf),
|
if (getnameinfo(sa, len, hbuf, sizeof(hbuf),
|
||||||
NULL, 0, NI_NAMEREQD))
|
NULL, 0, NI_NAMEREQD))
|
||||||
printf("could not resolve hostname");
|
printf("could not resolve hostname");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue