diff options
author | fenner <fenner@FreeBSD.org> | 2001-10-17 04:12:29 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2001-10-17 04:12:29 +0000 |
commit | 1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf (patch) | |
tree | 3a092a48e9ca517c0577423fc3e3894299750bb4 /usr.sbin | |
parent | b69c7c0b789e7ca4de555baab2ee087e1bb5d231 (diff) | |
download | FreeBSD-src-1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf.zip FreeBSD-src-1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf.tar.gz |
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
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/slstat/slstat.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/slstat/slstat.c b/usr.sbin/slstat/slstat.c index 27c27ed..ac1fa83 100644 --- a/usr.sbin/slstat/slstat.c +++ b/usr.sbin/slstat/slstat.c @@ -120,8 +120,12 @@ main(argc, argv) for (i = 1; ; i++) { name[4] = i; - if (sysctl(name, 6, &ifmd, &len, 0, 0) < 0) + if (sysctl(name, 6, &ifmd, &len, 0, 0) < 0) { + if (errno == ENOENT) + continue; + err(1, "sysctl"); + } if (strncmp(interface, ifmd.ifmd_name, IFNAMSIZ) == 0 && ifmd.ifmd_data.ifi_type == IFT_SLIP) { indx = i; |