diff --git a/CHANGES b/CHANGES index c3fb6370..862c1016 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm_sensors CHANGES file SVN-HEAD Library: Fix fschrc and fschmd support + Fix sysfs presence detection Makefile: Revert changeset 4738, fix bug #2187 differently Module eeprom: Hide Sony Vaio serial numbers to regular users (2.6 backport) Drop useless debugging log messages diff --git a/lib/sysfs.c b/lib/sysfs.c index 26c0ac05..8e162376 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -20,6 +20,9 @@ /* this define needed for strndup() */ #define _GNU_SOURCE +#include +#include +#include #include #include #include @@ -38,7 +41,13 @@ char sensors_sysfs_mount[NAME_MAX]; /* returns !0 if sysfs filesystem was found, 0 otherwise */ int sensors_init_sysfs(void) { - if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX) == 0) + struct stat statbuf; + + /* libsysfs will return success even if sysfs is not mounted, + so we have to double-check */ + if (sysfs_get_mnt_path(sensors_sysfs_mount, NAME_MAX) == 0 + && stat(sensors_sysfs_mount, &statbuf) == 0 + && statbuf.st_nlink > 2) sensors_found_sysfs = 1; return sensors_found_sysfs;