Add configure option for how read fails behave

Different platforms have different requirements for handling
hwmon sysfs access failures.

The default behavior is that a read failure leads to the daemon
exiting after some number of read failures.  This can be controlled
to then remove the object from the dbus on failure.  Now, it can
instead be controlled to return -errno on read failure.

This new behavior to set the value to -errno must be checked by
whatever mechanism is reporting the value.

Change-Id: I50b93aea56f22267da79c9571319f281e24a1e6f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index cfa5483..dfba15f 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -157,6 +157,16 @@
 
 int64_t adjustValue(const SensorSet::key_type& sensor, int64_t value)
 {
+// Because read doesn't have an out pointer to store errors.
+// let's assume negative values are errors if they have this
+// set.
+#ifdef NEGATIVE_ERRNO_ON_FAIL
+    if (value < 0)
+    {
+        return value;
+    }
+#endif
+
     const auto& it = sensorAdjusts.find(sensor);
     if (it != sensorAdjusts.end())
     {