mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-23 20:11:42 +00:00
Don't arbitrarily write errors to stderr. In production mode,
simply ignore the errors. In debug mode, call sensors_fatal_error(). As a side note, there is certainly room for improvement in the way errors are reported by libsensors. sensors_fatal_error() is fatal, and sensors_parse_error() is too specific, so we lack a more general error reporting function. printf-like formatting for error messages would also be a good idea. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4855 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
ab36c5b0f8
commit
55e467b151
1 file changed
+12
-9
+12
-9
@@ -213,15 +213,17 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
||||
switch (sftype & 0xFF00) {
|
||||
case SENSORS_SUBFEATURE_FAN_INPUT:
|
||||
case SENSORS_SUBFEATURE_TEMP_INPUT:
|
||||
if (nr)
|
||||
nr--;
|
||||
nr--;
|
||||
break;
|
||||
}
|
||||
|
||||
if (nr >= MAX_SENSORS_PER_TYPE) {
|
||||
fprintf(stderr, "libsensors error, more sensors of one"
|
||||
" type then MAX_SENSORS_PER_TYPE, ignoring "
|
||||
"subfeature: %s\n", name);
|
||||
if (nr < 0 || nr >= MAX_SENSORS_PER_TYPE) {
|
||||
/* More sensors of one type than MAX_SENSORS_PER_TYPE,
|
||||
we have to ignore it */
|
||||
#ifdef DEBUG
|
||||
sensors_fatal_error(__FUNCTION__,
|
||||
"Increase MAX_SENSORS_PER_TYPE!");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -243,9 +245,10 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
||||
}
|
||||
|
||||
if (all_subfeatures[i].name) {
|
||||
fprintf(stderr, "libsensors error, trying to add dupli"
|
||||
"cate subfeature: %s to dynamic feature table\n",
|
||||
name);
|
||||
#ifdef DEBUG
|
||||
sensors_fatal_error(__FUNCTION__,
|
||||
"Duplicate subfeature");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user