Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more error trap for getnameinfo.

  • Loading branch information...
commit a04f2ca68a446ac465104c9e2649fc4907c76b98 1 parent 64fd25f
itojun authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 kame/kame/libinet6/resolv/res_send.c
View
13 kame/kame/libinet6/resolv/res_send.c
@@ -55,7 +55,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id: res_send.c,v 1.12 2000/06/18 21:19:42 itojun Exp $";
+static char rcsid[] = "$Id: res_send.c,v 1.13 2000/06/18 21:39:21 itojun Exp $";
#endif /* LIBC_SCCS and not lint */
/* change this to "0"
@@ -139,9 +139,12 @@ static void Perror __P((FILE *, char *, int));
int save = errno;
if (_res.options & RES_DEBUG) {
- getnameinfo(address, address->sa_len, abuf, sizeof(abuf),
- pbuf, sizeof(pbuf),
- NI_NUMERICHOST|NI_NUMERICSERV|NI_WITHSCOPEID);
+ if (getnameinfo(address, address->sa_len, abuf, sizeof(abuf),
+ pbuf, sizeof(pbuf),
+ NI_NUMERICHOST|NI_NUMERICSERV|NI_WITHSCOPEID) != 0) {
+ strncpy(abuf, "?", sizeof(abuf));
+ strncpy(pbuf, "?", sizeof(pbuf));
+ }
fprintf(file, "res_send: %s ([%s].%s): %s\n",
string, abuf, pbuf, strerror(error));
}
@@ -437,7 +440,7 @@ res_send(buf, buflen, ans, anssiz)
Dprint((_res.options & RES_DEBUG) &&
getnameinfo(nsap, salen, abuf, sizeof(abuf),
- NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) == 0,
+ NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) == 0,
(stdout, ";; Querying server (# %d) address = %s\n",
ns + 1, abuf));
Please sign in to comment.
Something went wrong with that request. Please try again.