From 26f600b2aa43fa6f36f44a855acc185ea58e5a46 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Sep 2004 17:37:18 +0000 Subject: [PATCH] Fix a bug in libsensors which caused some failed feature writes ("set lines") to go unnoticed. lm78's fan3_div (which is read-only but stored in a R/W file in procfs) was one of them. Make sensors' error message in this case more explicit. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2692 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/access.c | 6 +++--- prog/sensors/main.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/access.c b/lib/access.c index 11038c56..002f0692 100644 --- a/lib/access.c +++ b/lib/access.c @@ -425,8 +425,8 @@ int sensors_do_this_chip_sets(sensors_chip_name name) { sensors_chip *chip; double value; - int err,i,j; - int res = 0; + int i, j; + int err = 0, res; const sensors_chip_feature *feature; int *feature_list = NULL; int feature_count = 0; @@ -464,7 +464,7 @@ int sensors_do_this_chip_sets(sensors_chip_name name) } } free(feature_list); - return res; + return err; } /* Execute all set statements for this particular chip. The chip may contain diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 96f85aa4..83a6a719 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -328,6 +328,9 @@ int do_a_set(sensors_chip_name name) sensors_strerror(res)); fprintf(stderr,"Run as root?\n"); return 1; + } else if (res == -SENSORS_ERR_ACCESS_W) { + fprintf(stderr, "%s: At least one \"set\" statement failed\n", + sprintf_chip_name(name)); } else { fprintf(stderr,"%s: %s\n",sprintf_chip_name(name), sensors_strerror(res));