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/fan_pwm.cpp b/fan_pwm.cpp
index 7675b10..91ba57d 100644
--- a/fan_pwm.cpp
+++ b/fan_pwm.cpp
@@ -41,7 +41,9 @@
auto file =
sysfs::make_sysfs_path(_ioAccess->path(), _type, _id, empty);
- 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);
}