diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-07-02 09:28:32 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-07-03 08:02:38 +0000 |
commit | f3f83d945605bbf381def5b2342f9f33f9601b68 (patch) | |
tree | 867a8c4b09396e5a8017eaf13600375cb0c3fc0d | |
parent | ce642db2fe673d25c2634b7e7f3c23d9012d7e6a (diff) |
use return from main() for clean shutdown
-rw-r--r-- | configd/src/apps/sentinel/sentinel.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/configd/src/apps/sentinel/sentinel.cpp b/configd/src/apps/sentinel/sentinel.cpp index 9f179e96393..1bab29e727e 100644 --- a/configd/src/apps/sentinel/sentinel.cpp +++ b/configd/src/apps/sentinel/sentinel.cpp @@ -30,7 +30,7 @@ main(int argc, char **argv) if (c != 'c') { LOG(error, "Usage: %s -c <config-id>", argv[0]); EV_STOPPING("config-sentinel", "Bad arguments on command line"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } std::string configId(optarg); @@ -45,7 +45,7 @@ main(int argc, char **argv) if (chdir(rootDir) == -1) { LOG(error, "Fatal: Cannot cd to $ROOT (%s)", rootDir); EV_STOPPING("config-sentinel", "Cannot cd to $ROOT"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } EV_STARTED("config-sentinel"); @@ -57,7 +57,7 @@ main(int argc, char **argv) if (setenv("LC_ALL", "C", 1) != 0) { LOG(error, "Unable to set locale"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } setlocale(LC_ALL, "C"); @@ -69,15 +69,15 @@ main(int argc, char **argv) } catch (ConfigTimeoutException & ex) { LOG(warning, "Timeout getting config, please check your setup. Will exit and restart: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } catch (InvalidConfigException& ex) { LOG(error, "Fatal: Invalid configuration, please check your setup: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } catch (ConfigRuntimeException& ex) { LOG(error, "Fatal: Could not get config, please check your setup: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } struct timeval lastTv; @@ -91,11 +91,11 @@ main(int argc, char **argv) } catch (vespalib::PortListenException& ex) { LOG(error, "Fatal: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } catch (vespalib::FatalException& ex) { LOG(error, "Fatal: %s", ex.getMessage().c_str()); EV_STOPPING("config-sentinel", ex.what()); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } if (vespalib::SignalHandler::CHLD.check()) { continue; |