diff options
author | simon <simon@FreeBSD.org> | 2010-07-24 10:04:35 +0000 |
---|---|---|
committer | simon <simon@FreeBSD.org> | 2010-07-24 10:04:35 +0000 |
commit | 8665304c8dd0e637e8aea8ec80b3dd93e52ff219 (patch) | |
tree | 01b0521ffcd94260d4d7e864a05ce4867caa3e25 /usr.sbin/bsnmpd | |
parent | 06b03cfd4f74f39b8d108da0e5db259b26f9e501 (diff) | |
download | FreeBSD-src-8665304c8dd0e637e8aea8ec80b3dd93e52ff219.zip FreeBSD-src-8665304c8dd0e637e8aea8ec80b3dd93e52ff219.tar.gz |
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
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r-- | usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c | 7 |
1 files changed, 5 insertions, 2 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 200f1ec..5460290 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_diskstorage_tbl.c @@ -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); |