summaryrefslogtreecommitdiffstats
path: root/softoff/mainapp.cpp
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-05-18 16:54:29 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-05-19 14:32:05 +0000
commit83527efebc74c906aa6e7ed3205703db48002619 (patch)
treeb0f0b8ff82c7afa2eb0980bd5b2699cc967c66d1 /softoff/mainapp.cpp
parentf0f496c11835d07bab6957aee6f8da61116821cb (diff)
downloadphosphor-host-ipmid-83527efebc74c906aa6e7ed3205703db48002619.tar.gz
phosphor-host-ipmid-83527efebc74c906aa6e7ed3205703db48002619.zip
Ensure softpoweroff application returns non-zero rc on fails
This will ensure we follow the OnFailure= behavior defined within the shutdown target and properly power the system off on fails Change-Id: I4367602741ec06f32e5a39a21fccc914739fdda6 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'softoff/mainapp.cpp')
-rw-r--r--softoff/mainapp.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/softoff/mainapp.cpp b/softoff/mainapp.cpp
index 0bfb067..7cf0eb7 100644
--- a/softoff/mainapp.cpp
+++ b/softoff/mainapp.cpp
@@ -21,6 +21,8 @@
#include "config.h"
#include "timer.hpp"
+// Return -1 on any errors to ensure we follow the calling targets OnFailure=
+// path
int main(int argc, char** argv)
{
using namespace phosphor::logging;
@@ -34,14 +36,13 @@ int main(int argc, char** argv)
// Add systemd object manager.
sdbusplus::server::manager::manager(bus, SOFTOFF_OBJPATH);
- // sd_event object. StateManager wants that this applicatin return '0'
- // always.
+ // sd_event object
auto r = sd_event_default(&events);
if (r < 0)
{
log<level::ERR>("Failure to create sd_event handler",
entry("ERROR=%s", strerror(-r)));
- return 0;
+ return -1;
}
// Attach the bus to sd_event to service user requests
@@ -65,7 +66,7 @@ int main(int argc, char** argv)
{
log<level::ERR>("Failure in processing request",
entry("ERROR=%s", strerror(-r)));
- break;
+ return -1;
}
}
@@ -78,6 +79,7 @@ int main(int argc, char** argv)
sdbusplus::xyz::openbmc_project::State::Host::Error::SoftOffTimeout;
using errorMetadata = xyz::openbmc_project::State::Host::SoftOffTimeout;
report<error>(prev_entry<errorMetadata::TIMEOUT_IN_MSEC>());
+ return -1;
}
// Cleanup the event handler
OpenPOWER on IntegriCloud