Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/netstat PR/47744: Frank Kardel: netstat -s stops out...



details:   https://anonhg.NetBSD.org/src/rev/329dc3369733
branches:  trunk
changeset: 786111:329dc3369733
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 15 21:20:39 2013 +0000

description:
PR/47744: Frank Kardel: netstat -s stops output prematurely when ipsec is not
compiled.
If the first sysctl fails return silently.
XXX: pullup-6

diffstat:

 usr.bin/netstat/fast_ipsec.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 162156f34c47 -r 329dc3369733 usr.bin/netstat/fast_ipsec.c
--- a/usr.bin/netstat/fast_ipsec.c      Mon Apr 15 19:46:16 2013 +0000
+++ b/usr.bin/netstat/fast_ipsec.c      Mon Apr 15 21:20:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fast_ipsec.c,v 1.19 2012/03/22 20:34:43 drochner Exp $ */
+/*     $NetBSD: fast_ipsec.c,v 1.20 2013/04/15 21:20:39 christos Exp $ */
 /*     $FreeBSD: src/tools/tools/crypto/ipsecstats.c,v 1.1.4.1 2003/06/03 00:13:13 sam Exp $ */
 
 /*-
@@ -33,7 +33,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #ifdef __NetBSD__
-__RCSID("$NetBSD: fast_ipsec.c,v 1.19 2012/03/22 20:34:43 drochner Exp $");
+__RCSID("$NetBSD: fast_ipsec.c,v 1.20 2013/04/15 21:20:39 christos Exp $");
 #endif
 #endif /* not lint*/
 
@@ -152,8 +152,12 @@
        slen = sizeof(ipsecstats);
        status = sysctlbyname("net.inet.ipsec.ipsecstats", ipsecstats, &slen,
                              NULL, 0);
-       if (status < 0 && errno != ENOMEM)
-               err(1, "net.inet.ipsec.ipsecstats");
+       if (status < 0) {
+               if (errno == ENOENT)
+                       return;
+               if (errno != ENOMEM)
+                       err(1, "net.inet.ipsec.ipsecstats");
+       }
 
        slen = sizeof (ahstats);
        status = sysctlbyname("net.inet.ah.ah_stats", ahstats, &slen, NULL, 0);



Home | Main Index | Thread Index | Old Index