diff --git a/CHANGES b/CHANGES index 20894860..906b3666 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ lm-sensors CHANGES file SVN Makefile: Add sensors-conf-convert to make install + libsensors: Notify the caller when writing a value fails 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 8317a932..f869cb13 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -577,9 +577,11 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, snprintf(n, NAME_MAX, "%s/%s", name->path, subfeature->name); if ((f = fopen(n, "w"))) { + int res; value *= get_type_scaling(subfeature->type); - fprintf(f, "%d", (int) value); - fclose(f); + res = fprintf(f, "%d", (int) value); + if (fclose(f) || res < 0) + return -SENSORS_ERR_ACCESS_W; } else return -SENSORS_ERR_KERNEL;