summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-10-19 17:18:34 -0700
committerWilliam A. Kennington III <wak@google.com>2018-10-19 17:26:03 -0700
commit3e781064f534ae0c822ac4c4f5590635633aa394 (patch)
tree675226520152cb0f58c1334a42ddfcec3c1d3c22
parentb884821df59d8f477d715f326caf74790647dede (diff)
downloadphosphor-fan-presence-3e781064f534ae0c822ac4c4f5590635633aa394.zip
phosphor-fan-presence-3e781064f534ae0c822ac4c4f5590635633aa394.tar.gz
Fix exit status codes
Using an exit status of -1 everywhere leads to the status being converted to 255 when output to a calling application. While this does signify an error it has a reserved meaning for exit status out of range. Lets use a valid general exit status of 1 instead. Change-Id: I326701c78985e34c430c258fe31d9e910da10405 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--control/argument.cpp2
-rwxr-xr-xcontrol/gen-fan-zone-defs.py2
-rw-r--r--control/main.cpp10
-rw-r--r--cooling-type/argument.cpp2
-rw-r--r--cooling-type/main.cpp6
-rw-r--r--evdevpp/test/evmon.cpp4
-rw-r--r--monitor/argument.cpp2
-rwxr-xr-xmonitor/gen-fan-monitor-defs.py2
-rw-r--r--monitor/main.cpp8
9 files changed, 18 insertions, 20 deletions
diff --git a/control/argument.cpp b/control/argument.cpp
index d9b832d..e014453 100644
--- a/control/argument.cpp
+++ b/control/argument.cpp
@@ -33,7 +33,7 @@ ArgumentParser::ArgumentParser(int argc, char** argv)
if ((option == '?') || (option == 'h'))
{
usage(argv);
- exit(-1);
+ exit(1);
}
auto i = &options[0];
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 644ce54..e5aa39b 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -600,7 +600,7 @@ if __name__ == '__main__':
if not args.zone_yaml or not args.fan_yaml:
parser.print_usage()
- sys.exit(-1)
+ sys.exit(1)
with open(args.zone_yaml, 'r') as zone_input:
zone_data = yaml.safe_load(zone_input) or {}
diff --git a/control/main.cpp b/control/main.cpp
index 80a7df6..8c13cf9 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -32,7 +32,7 @@ int main(int argc, char* argv[])
if (argc != 2)
{
args.usage(argv);
- exit(-1);
+ return 1;
}
Mode mode;
@@ -48,7 +48,7 @@ int main(int argc, char* argv[])
else
{
args.usage(argv);
- exit(-1);
+ return 1;
}
auto r = sd_event_default(&events);
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
{
log<level::ERR>("Failed call to sd_event_default()",
entry("ERROR=%s", strerror(-r)));
- return -1;
+ return 1;
}
phosphor::fan::event::EventPtr eventPtr{events};
@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
}
}
//Log the useful metadata on these exceptions and let the app
- //return -1 so it is restarted without a core dump.
+ //return 1 so it is restarted without a core dump.
catch (phosphor::fan::util::DBusServiceError& e)
{
log<level::ERR>("Uncaught DBus service lookup failure exception",
@@ -110,5 +110,5 @@ int main(int argc, char* argv[])
entry("PROPERTY=%s", e.property.c_str()));
}
- return -1;
+ return 1;
}
diff --git a/cooling-type/argument.cpp b/cooling-type/argument.cpp
index 2c9a580..2c54f75 100644
--- a/cooling-type/argument.cpp
+++ b/cooling-type/argument.cpp
@@ -34,7 +34,7 @@ ArgumentParser::ArgumentParser(int argc, char** argv)
if ((option == '?') || (option == 'h'))
{
usage(argv);
- exit(-1);
+ exit(1);
}
auto i = &options[0];
diff --git a/cooling-type/main.cpp b/cooling-type/main.cpp
index f690f80..3aa7d28 100644
--- a/cooling-type/main.cpp
+++ b/cooling-type/main.cpp
@@ -12,7 +12,7 @@ using namespace phosphor::logging;
int main(int argc, char* argv[])
{
- auto rc = -1;
+ auto rc = 1;
auto options = ArgumentParser(argc, argv);
auto objpath = (options)["path"];
@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
else
{
log<level::ERR>("--event=<keycode> argument required\n");
- exit(-1);
+ return rc;
}
}
@@ -66,7 +66,6 @@ int main(int argc, char* argv[])
}
catch (DBusMethodError& dme)
{
- rc = -1;
log<level::ERR>("Uncaught DBus method failure exception",
entry("BUSNAME=%s", dme.busName.c_str()),
entry("PATH=%s", dme.path.c_str()),
@@ -75,7 +74,6 @@ int main(int argc, char* argv[])
}
catch (std::exception& err)
{
- rc = -1;
log<phosphor::logging::level::ERR>(err.what());
}
diff --git a/evdevpp/test/evmon.cpp b/evdevpp/test/evmon.cpp
index 26163a7..526f759 100644
--- a/evdevpp/test/evmon.cpp
+++ b/evdevpp/test/evmon.cpp
@@ -40,7 +40,7 @@ ArgumentParser::ArgumentParser(int argc, char** argv)
if ((option == '?') || (option == 'h'))
{
usage(argv);
- exit(-1);
+ exit(1);
}
auto i = &options[0];
@@ -97,7 +97,7 @@ static void exit_with_error(const char* err, char** argv)
ArgumentParser::usage(argv);
std::cerr << "\n";
std::cerr << "ERROR: " << err << "\n";
- exit(-1);
+ exit(1);
}
} // namespace util
diff --git a/monitor/argument.cpp b/monitor/argument.cpp
index 2fbef68..c756649 100644
--- a/monitor/argument.cpp
+++ b/monitor/argument.cpp
@@ -33,7 +33,7 @@ ArgumentParser::ArgumentParser(int argc, char** argv)
if ((option == '?') || (option == 'h'))
{
usage(argv);
- exit(-1);
+ exit(1);
}
auto i = &options[0];
diff --git a/monitor/gen-fan-monitor-defs.py b/monitor/gen-fan-monitor-defs.py
index a5f225b..de25fef 100755
--- a/monitor/gen-fan-monitor-defs.py
+++ b/monitor/gen-fan-monitor-defs.py
@@ -126,7 +126,7 @@ if __name__ == '__main__':
if not args.monitor_yaml:
parser.print_usage()
- sys.exit(-1)
+ sys.exit(1)
with open(args.monitor_yaml, 'r') as monitor_input:
monitor_data = yaml.safe_load(monitor_input) or {}
diff --git a/monitor/main.cpp b/monitor/main.cpp
index 84dd7d1..512e3f7 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -35,7 +35,7 @@ int main(int argc, char* argv[])
if (argc != 2)
{
args.usage(argv);
- exit(-1);
+ return 1;
}
Mode mode;
@@ -50,7 +50,7 @@ int main(int argc, char* argv[])
else
{
args.usage(argv);
- exit(-1);
+ return 1;
}
auto r = sd_event_default(&events);
@@ -58,7 +58,7 @@ int main(int argc, char* argv[])
{
log<level::ERR>("Failed call to sd_event_default()",
entry("ERROR=%s", strerror(-r)));
- return -1;
+ return 1;
}
std::unique_ptr<phosphor::fan::trust::Manager> trust =
@@ -101,5 +101,5 @@ int main(int argc, char* argv[])
}
}
- return -1;
+ return 1;
}
OpenPOWER on IntegriCloud