vpd-tool: handle error code
This commit handles error code for write keyword command, as the
std::error_code should be checked only when filesystem::exists call
returns with false.
Change-Id: If90170f32a8e8798ba88b932da479dc3609afd22
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-tool/src/vpd_tool_main.cpp b/vpd-tool/src/vpd_tool_main.cpp
index 4dde248..fa99c3b 100644
--- a/vpd-tool/src/vpd_tool_main.cpp
+++ b/vpd-tool/src/vpd_tool_main.cpp
@@ -86,15 +86,12 @@
if (!i_hardwareFlag->empty() && !std::filesystem::exists(i_vpdPath, l_ec))
{
- std::cerr << "Given EEPROM file path doesn't exist : " + i_vpdPath
+ std::cerr << "Given EEPROM file path doesn't exist[" + i_vpdPath << "]."
<< std::endl;
- return vpd::constants::FAILURE;
- }
-
- if (l_ec)
- {
- std::cerr << "filesystem call exists failed for file: " << i_vpdPath
- << ", reason: " + l_ec.message() << std::endl;
+ if (l_ec)
+ {
+ std::cerr << "Reason: " + l_ec.message() << std::endl;
+ }
return vpd::constants::FAILURE;
}