summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2006-01-26 11:49:27 +0000
committerharti <harti@FreeBSD.org>2006-01-26 11:49:27 +0000
commit0dafc475950c55a5fd676d03caf579072375505a (patch)
tree1f8d901931d748549fb23bebaa619002eb6222d5 /usr.sbin/bsnmpd
parentbe52ac2832da4e63818c5c6287ad2eef66b68455 (diff)
downloadFreeBSD-src-0dafc475950c55a5fd676d03caf579072375505a.zip
FreeBSD-src-0dafc475950c55a5fd676d03caf579072375505a.tar.gz
Fix false positives when searching for disks. Things like adv(4) are not
disks. Submitted by: Victor Cruceru <soc-victor@>
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r--usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c
index 42f78cb..10cce50 100644
--- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c
+++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c
@@ -43,6 +43,7 @@
#include <sys/sysctl.h>
#include <assert.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <paths.h>
@@ -279,6 +280,14 @@ disk_OS_get_ATA_disks(void)
strlen(found->dev_name)) != 0)
continue;
+ /*
+ * Avoid false disk devices. For example adw(4) and
+ * adv(4) - they are not disks!
+ */
+ if (strlen(map->name_key) > strlen(found->dev_name) &&
+ !isdigit(map->name_key[strlen(found->dev_name)]))
+ continue;
+
/* First get the entry from the hrDeviceTbl */
entry = map->entry_p;
entry->type = OIDX_hrDeviceDiskStorage_c;
OpenPOWER on IntegriCloud