mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-20 19:41:47 +00:00
Do not attempt to read label files from procfs, they do not exist
there. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4792 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
44b77f38e4
commit
0ce944ad66
1 file changed
+18
-14
+18
-14
@@ -27,6 +27,7 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
#include "sysfs.h"
|
||||||
|
|
||||||
static int sensors_do_this_chip_sets(sensors_chip_name name);
|
static int sensors_do_this_chip_sets(sensors_chip_name name);
|
||||||
|
|
||||||
@@ -149,8 +150,6 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result)
|
|||||||
{
|
{
|
||||||
const sensors_chip *chip;
|
const sensors_chip *chip;
|
||||||
const sensors_chip_feature *featureptr;
|
const sensors_chip_feature *featureptr;
|
||||||
char buf[128], path[PATH_MAX];
|
|
||||||
FILE *f;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
@@ -166,18 +165,23 @@ int sensors_get_label(sensors_chip_name name, int feature, char **result)
|
|||||||
goto sensors_get_label_exit;
|
goto sensors_get_label_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No user specified label, check for a _label sysfs file */
|
if (sensors_found_sysfs) {
|
||||||
snprintf(path, PATH_MAX, "%s/%s_label", name.busname,
|
char buf[128], path[PATH_MAX];
|
||||||
featureptr->data.name);
|
FILE *f;
|
||||||
|
|
||||||
if ((f = fopen(path, "r"))) {
|
/* No user specified label, check for a _label sysfs file */
|
||||||
i = fread(buf, 1, sizeof(buf) - 1, f);
|
snprintf(path, PATH_MAX, "%s/%s_label", name.busname,
|
||||||
fclose(f);
|
featureptr->data.name);
|
||||||
if (i > 0) {
|
|
||||||
/* i - 1 to strip the '\n' at the end */
|
if ((f = fopen(path, "r"))) {
|
||||||
buf[i - 1] = 0;
|
i = fread(buf, 1, sizeof(buf) - 1, f);
|
||||||
*result = strdup(buf);
|
fclose(f);
|
||||||
goto sensors_get_label_exit;
|
if (i > 0) {
|
||||||
|
/* i - 1 to strip the '\n' at the end */
|
||||||
|
buf[i - 1] = 0;
|
||||||
|
*result = strdup(buf);
|
||||||
|
goto sensors_get_label_exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user