summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2005-04-11 21:05:02 +0000
committerChad Loder <cloder@cvs.openbsd.org>2005-04-11 21:05:02 +0000
commitc4023dd00fa11898ca9a3b8d3593403c16fbe7e5 (patch)
treeb166e18e105d8f55ecdfd66e050e84d9f4929866 /sbin
parent71249545340efa845ce5a468684b4dc88aa74be7 (diff)
Handle getnameinfo failure. OK niallo
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ifconfig/ifconfig.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 3ae8ec6514e..0d1f2fdf5b1 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.133 2005/04/04 16:03:02 deraadt Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.134 2005/04/11 21:05:01 cloder Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -77,7 +77,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
#else
-static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.133 2005/04/04 16:03:02 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: ifconfig.c,v 1.134 2005/04/11 21:05:01 cloder Exp $";
#endif
#endif /* not lint */
@@ -1958,8 +1958,9 @@ phys_status(int force)
if (req.addr.ss_family == AF_INET6)
in6_fillscopeid((struct sockaddr_in6 *)&req.addr);
#endif /* INET6 */
- getnameinfo((struct sockaddr *)&req.addr, req.addr.ss_len,
- psrcaddr, sizeof(psrcaddr), 0, 0, niflag);
+ if (getnameinfo((struct sockaddr *)&req.addr, req.addr.ss_len,
+ psrcaddr, sizeof(psrcaddr), 0, 0, niflag) != 0)
+ strlcpy(psrcaddr, "<error>", sizeof(psrcaddr));
#ifdef INET6
if (req.addr.ss_family == AF_INET6)
ver = "6";
@@ -1969,8 +1970,9 @@ phys_status(int force)
if (req.dstaddr.ss_family == AF_INET6)
in6_fillscopeid((struct sockaddr_in6 *)&req.dstaddr);
#endif /* INET6 */
- getnameinfo((struct sockaddr *)&req.dstaddr, req.dstaddr.ss_len,
- pdstaddr, sizeof(pdstaddr), 0, 0, niflag);
+ if (getnameinfo((struct sockaddr *)&req.dstaddr, req.dstaddr.ss_len,
+ pdstaddr, sizeof(pdstaddr), 0, 0, niflag) != 0)
+ strlcpy(pdstaddr, "<error>", sizeof(pdstaddr));
printf("\tphysical address inet%s %s --> %s\n", ver,
psrcaddr, pdstaddr);