mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-20 19:41:47 +00:00
Fix sysfs presence detection. Since sysfsutils 2.0.0, libsysfs will
return success even if sysfs isn't mounted. We have to check by ourselves if it is mounted or not, so that we can fallback to procfs on Linux 2.4 systems. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5036 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
8773c670cf
commit
3e46333e7c
2 files changed
+11
-1
No files matched your search
@@ -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
|
||||
|
||||
+10
-1
@@ -20,6 +20,9 @@
|
||||
/* this define needed for strndup() */
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user