svn commit: r210442 - head/usr.sbin/bsnmpd/modules/snmp_hostres
Simon L. Nielsen
simon at FreeBSD.org
Sat Jul 24 10:04:35 UTC 2010
Author: simon
Date: Sat Jul 24 10:04:35 2010
New Revision: 210442
URL: http://svn.freebsd.org/changeset/base/210442
Log:
Make failed open of /dev/mdctl in the bsnmpd hostres module non-fatal.
This makes it possible to use the hostres module when bsnmpd is not
running as root.
MFC after: 1 week
Modified:
head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c
Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c
==============================================================================
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Sat Jul 24 01:52:26 2010 (r210441)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c Sat Jul 24 10:04:35 2010 (r210442)
@@ -340,6 +340,9 @@ disk_OS_get_MD_disks(void)
struct md_ioctl mdio;
int unit;
+ if (md_fd <= 0)
+ return;
+
/* Look for md devices */
STAILQ_FOREACH(map, &device_map, link) {
if (sscanf(map->name_key, "md%d", &unit) != 1)
@@ -546,8 +549,8 @@ init_disk_storage_tbl(void)
md_fd = -1;
snprintf(mddev, sizeof(mddev) - 1, "%s%s", _PATH_DEV, MDCTL_NAME);
if ((md_fd = open(mddev, O_RDWR)) == -1) {
- syslog(LOG_ERR, "open %s failed: %m", mddev);
- return (-1);
+ syslog(LOG_ERR, "open %s failed - will not include md(4) "
+ "info: %m", mddev);
}
refresh_disk_storage_tbl(1);
More information about the svn-src-head
mailing list