diff options
author | Kevin Steves <stevesk@cvs.openbsd.org> | 2006-01-03 01:46:28 +0000 |
---|---|---|
committer | Kevin Steves <stevesk@cvs.openbsd.org> | 2006-01-03 01:46:28 +0000 |
commit | 806b6ee6d6071027814c4f64e03a7a3f8ff6dd73 (patch) | |
tree | 416329c355ac7021a828ce016cb770a8771fcef5 /usr.sbin/tcpdrop | |
parent | d211e3ae05051f865f78712ff1c2d29df3007709 (diff) |
check getnameinfo() return for 0 and use errx() vs. err(); old ok markus@
Diffstat (limited to 'usr.sbin/tcpdrop')
-rw-r--r-- | usr.sbin/tcpdrop/tcpdrop.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/tcpdrop/tcpdrop.c b/usr.sbin/tcpdrop/tcpdrop.c index 3bce2bbde1b..5857446f0bb 100644 --- a/usr.sbin/tcpdrop/tcpdrop.c +++ b/usr.sbin/tcpdrop/tcpdrop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpdrop.c,v 1.4 2004/05/22 23:55:22 deraadt Exp $ */ +/* $OpenBSD: tcpdrop.c,v 1.5 2006/01/03 01:46:27 stevesk Exp $ */ /* * Copyright (c) 2004 Markus Friedl <markus@openbsd.org> @@ -74,16 +74,16 @@ main(int argc, char **argv) memcpy(&tir.faddr, aif->ai_addr, aif->ai_addrlen); memcpy(&tir.laddr, ail->ai_addr, ail->ai_addrlen); - if (getnameinfo(aif->ai_addr, aif->ai_addrlen, + if ((gaierr = getnameinfo(aif->ai_addr, aif->ai_addrlen, fhbuf, sizeof(fhbuf), fsbuf, sizeof(fsbuf), - NI_NUMERICHOST | NI_NUMERICSERV) == -1) - err(1, "getnameinfo"); - if (getnameinfo(ail->ai_addr, ail->ai_addrlen, + NI_NUMERICHOST | NI_NUMERICSERV)) != 0) + errx(1, "getnameinfo: %s", gai_strerror(gaierr)); + if ((gaierr = getnameinfo(ail->ai_addr, ail->ai_addrlen, lhbuf, sizeof(lhbuf), lsbuf, sizeof(lsbuf), - NI_NUMERICHOST | NI_NUMERICSERV) == -1) - err(1, "getnameinfo"); + NI_NUMERICHOST | NI_NUMERICSERV)) != 0) + errx(1, "getnameinfo: %s", gai_strerror(gaierr)); if (sysctl(mib, sizeof (mib) / sizeof (int), NULL, NULL, &tir, sizeof(tir)) == -1) { |