libsensors: Notify the caller when writing a value fails.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4895 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-09-29 11:57:37 +00:00
1 parent 1124e53305
commit 301e18b511
2 files changed
+5 -2

No files matched your search

+1
View File
@@ -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
+4 -2
View File
@@ -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;