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_speed.cpp b/fan_speed.cpp
index e990410..9ce625b 100644
--- a/fan_speed.cpp
+++ b/fan_speed.cpp
@@ -41,8 +41,9 @@
auto file = sysfs::make_sysfs_path(_ioAccess->path(), _type, _id,
entry::target);
- 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);
}
@@ -76,8 +77,9 @@
auto fullPath = sysfs::make_sysfs_path(_ioAccess->path(), type::pwm,
_id, entry::enable);
- log<level::INFO>(
- fmt::format("Failing sysfs file: {}", fullPath).c_str());
+ log<level::INFO>(fmt::format("Failing sysfs file: {} errno: {}",
+ fullPath, e.code().value())
+ .c_str());
exit(EXIT_FAILURE);
}