Print the errno from a fail in the journal
When a file access fails, print the errno of the failure in the same
journal entry the filename is already printed.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I20d268f563cf1bbfa2a5f9780c02998d075f5275
diff --git a/mainloop.cpp b/mainloop.cpp
index b694261..3e7e0bf 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -240,7 +240,9 @@
xyz::openbmc_project::Sensor::Device::ReadFailure::
CALLOUT_DEVICE_PATH(_devPath.c_str()));
- log<level::INFO>(fmt::format("Failing sysfs file: {}", file).c_str());
+ log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}", file,
+ e.code().value())
+ .c_str());
exit(EXIT_FAILURE);
}
auto sensorValue = valueInterface->value();
@@ -530,8 +532,9 @@
xyz::openbmc_project::Sensor::Device::ReadFailure::
CALLOUT_DEVICE_PATH(_devPath.c_str()));
- log<level::INFO>(
- fmt::format("Failing sysfs file: {}", file).c_str());
+ log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+ file, e.code().value())
+ .c_str());
exit(EXIT_FAILURE);
}