diff --git a/CHANGES b/CHANGES index 906b3666..21b173fd 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ lm-sensors CHANGES file SVN Makefile: Add sensors-conf-convert to make install libsensors: Notify the caller when writing a value fails + Differentiate between different read error types sensord: Log the error code on failure sensors: Fix spurious critical temperature alarm sensors-conf-convert: Add a short help text diff --git a/lib/sysfs.c b/lib/sysfs.c index f869cb13..dbcd505a 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -558,9 +558,8 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "r"))) { int res = fscanf(f, "%lf", value); - fclose(f); - if (res != 1) - return -SENSORS_ERR_KERNEL; + if (fclose(f) || res != 1) + return -SENSORS_ERR_ACCESS_R; *value /= get_type_scaling(subfeature->type); } else return -SENSORS_ERR_KERNEL;