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
This commit is contained in:
parent
96d1cd1879
commit
12b052b9e0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210442
@ -340,6 +340,9 @@ disk_OS_get_MD_disks(void)
|
|||||||
struct md_ioctl mdio;
|
struct md_ioctl mdio;
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
|
if (md_fd <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Look for md devices */
|
/* Look for md devices */
|
||||||
STAILQ_FOREACH(map, &device_map, link) {
|
STAILQ_FOREACH(map, &device_map, link) {
|
||||||
if (sscanf(map->name_key, "md%d", &unit) != 1)
|
if (sscanf(map->name_key, "md%d", &unit) != 1)
|
||||||
@ -546,8 +549,8 @@ init_disk_storage_tbl(void)
|
|||||||
md_fd = -1;
|
md_fd = -1;
|
||||||
snprintf(mddev, sizeof(mddev) - 1, "%s%s", _PATH_DEV, MDCTL_NAME);
|
snprintf(mddev, sizeof(mddev) - 1, "%s%s", _PATH_DEV, MDCTL_NAME);
|
||||||
if ((md_fd = open(mddev, O_RDWR)) == -1) {
|
if ((md_fd = open(mddev, O_RDWR)) == -1) {
|
||||||
syslog(LOG_ERR, "open %s failed: %m", mddev);
|
syslog(LOG_ERR, "open %s failed - will not include md(4) "
|
||||||
return (-1);
|
"info: %m", mddev);
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_disk_storage_tbl(1);
|
refresh_disk_storage_tbl(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user