mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-26 20:38:20 +00:00
Check for fscanf() failure when reading sysfs attributes.
Also drop a redundant return. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4081 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
4c211d81d9
commit
a526a4a690
1 file changed
+3
-2
+3
-2
@@ -160,11 +160,12 @@ int sensors_read_proc(sensors_chip_name name, int feature, double *value)
|
||||
getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0'));
|
||||
if ((f = fopen(n, "r")) != NULL
|
||||
|| (f = fopen(altn, "r")) != NULL) {
|
||||
fscanf(f, "%lf", value);
|
||||
int res = fscanf(f, "%lf", value);
|
||||
fclose(f);
|
||||
if (res != 1)
|
||||
return -SENSORS_ERR_PROC;
|
||||
for (; mag > 0; mag --)
|
||||
*value /= 10.0;
|
||||
return 0;
|
||||
} else
|
||||
return -SENSORS_ERR_PROC;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user