appcommands: handle system result for sled-cycle
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ib62cc7bae69e44f5fda40c846ec722d1fc0e652b
diff --git a/src/appcommands.cpp b/src/appcommands.cpp
index ce5c13b..a4aa3cc 100644
--- a/src/appcommands.cpp
+++ b/src/appcommands.cpp
@@ -136,21 +136,26 @@
{
uint8_t* req = reinterpret_cast<uint8_t*>(request);
std::string mfrTest = "sled-cycle";
+ ipmi_ret_t rc = IPMI_CC_OK;
if (!memcmp(req, mfrTest.data(), mfrTest.length()) &&
(*data_len == mfrTest.length()))
{
/* sled-cycle the BMC */
- system("/usr/sbin/power-util sled-cycle");
+ auto ret = system("/usr/sbin/power-util sled-cycle");
+ if (ret)
+ {
+ rc = IPMI_CC_UNSPECIFIED_ERROR;
+ }
}
else
{
- return IPMI_CC_SYSTEM_INFO_PARAMETER_NOT_SUPPORTED;
+ rc = IPMI_CC_SYSTEM_INFO_PARAMETER_NOT_SUPPORTED;
}
*data_len = 0;
- return IPMI_CC_OK;
+ return rc;
}
//----------------------------------------------------------------------