summaryrefslogtreecommitdiff
path: root/libexec/rpc.rstatd
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>2001-10-17 04:12:29 +0000
committerBill Fenner <fenner@FreeBSD.org>2001-10-17 04:12:29 +0000
commitb9d45cebf476588f9bbe0c5534fd3a7cb2f0528e (patch)
tree3a092a48e9ca517c0577423fc3e3894299750bb4 /libexec/rpc.rstatd
parent2856a77139a76205cd66217939530c786622e23c (diff)
downloadsrc-test2-b9d45cebf476588f9bbe0c5534fd3a7cb2f0528e.tar.gz
src-test2-b9d45cebf476588f9bbe0c5534fd3a7cb2f0528e.zip
The interface index space may be sparsely populated (e.g. when an
interface in the middle is if_detach()'d). Return (and handle) ENOENT when the ifmib(4) is accessed for a nonexistent interface. MFC after: 14 days
Notes
Notes: svn path=/head/; revision=85040
Diffstat (limited to 'libexec/rpc.rstatd')
-rw-r--r--libexec/rpc.rstatd/rstat_proc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c
index 10143267f66b..2b63394ddb9b 100644
--- a/libexec/rpc.rstatd/rstat_proc.c
+++ b/libexec/rpc.rstatd/rstat_proc.c
@@ -51,6 +51,7 @@ static const char rcsid[] =
#include <sys/param.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <kvm.h>
#include <limits.h>
@@ -294,6 +295,9 @@ updatestat()
mib[4] = i;
mib[5] = IFDATA_GENERAL;
if (sysctl(mib, 6, &ifmd, &len, 0, 0) < 0) {
+ if (errno == ENOENT)
+ continue;
+
syslog(LOG_ERR, "sysctl(net.link.ifdata.%d.general)"
": %m", i);
exit(1);