mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-20 19:41:47 +00:00
Emit missing sensor warning only if SENSORS_SYSFS_ROOT is defined
The lm-sensors library is widely used in various software, which could
be run in VMs where HWMON support may be absent (e.g. cloud kernels in
Debian). To avoid a confusing "/sys: No sensors at /sys/class/hwmon" on
the console or in the logs, only emit the message if the user specifies
an alternative path through SENSORS_SYSFS_ROOT. This behavior mirrors
what is done for the "Not a sysfs mount" message.
Fixes: 89548dab2a ("Add SENSORS_SYSFS_ROOT environment support")
This commit is contained in:
1 parent
01359701a2
commit
6282f6925a
1 file changed
+1
-1
+1
-1
@@ -755,7 +755,7 @@ int sensors_init_sysfs(void)
|
||||
|
||||
snprintf(hwmon_path, length, "%s%s", sensors_sysfs_mount, hwmon_subdir);
|
||||
result = !stat(hwmon_path, &statbuf) && ((statbuf.st_mode & S_IFMT) == S_IFDIR);
|
||||
if (!result)
|
||||
if (sysfs_root_env && !result)
|
||||
fprintf(stderr, "%s: No sensors at %s.\n", sensors_sysfs_mount, hwmon_path);
|
||||
|
||||
free(hwmon_path);
|
||||
|
||||
Reference in new issue
Block a user