sensors/lm_sensors-r5580-sensord-survive-transient-errors.patch

55 lines
1.7 KiB
Diff

--- lm-sensors-3.0.0/prog/sensord/sensord.c (revision 5163)
+++ lm-sensors-3.0.0/prog/sensord/sensord.c (revision 5580)
@@ -91,20 +91,24 @@
sensorLog (LOG_INFO, "sensord started");
- while (!done && (ret == 0)) {
+ while (!done) {
if (reload) {
ret = reloadLib (sensorsCfgFile);
+ if (ret)
+ sensorLog (LOG_NOTICE, "config reload error (%d)", ret);
reload = 0;
}
- if ((ret == 0) && scanTime) { /* should I scan on the read cycle? */
- ret = scanChips ();
- if (scanValue <= 0)
- scanValue += scanTime;
- }
- if ((ret == 0) && logTime && (logValue <= 0)) {
- ret = readChips ();
+ if (scanTime && (scanValue <= 0)) {
+ if ((ret = scanChips ()))
+ sensorLog (LOG_NOTICE, "sensor scan error (%d)", ret);
+ scanValue += scanTime;
+ }
+ if (logTime && (logValue <= 0)) {
+ if ((ret = readChips ()))
+ sensorLog (LOG_NOTICE, "sensor read error (%d)", ret);
logValue += logTime;
}
- if ((ret == 0) && rrdTime && rrdFile && (rrdValue <= 0)) {
- ret = rrdUpdate ();
+ if (rrdTime && rrdFile && (rrdValue <= 0)) {
+ if ((ret = rrdUpdate ()))
+ sensorLog (LOG_NOTICE, "rrd update error (%d)", ret);
/*
* The amount of time to wait is computed using the same method as
@@ -113,5 +117,5 @@
rrdValue = rrdTime - time(NULL) % rrdTime;
}
- if (!done && (ret == 0)) {
+ if (!done) {
int a = logTime ? logValue : INT_MAX;
int b = scanTime ? scanValue : INT_MAX;
@@ -125,8 +129,5 @@
}
- if (ret)
- sensorLog (LOG_INFO, "sensord failed (%d)", ret);
- else
- sensorLog (LOG_INFO, "sensord stopped");
+ sensorLog (LOG_INFO, "sensord stopped");
return ret;