diff options
author | Sadie Powell <sadie@witchery.services> | 2024-01-05 11:55:20 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-01-05 12:00:28 +0000 |
commit | 4573e1925dc62415306a29e7fbbec6727649aef9 (patch) | |
tree | 4ff4ae30a3408cf6507d7b7d1271b54836cf40f6 /src | |
parent | a40f8e0b9d397f2e15d141c5bec823c633a6f90a (diff) |
Use normal exit codes when exiting the process.
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 11 | ||||
-rw-r--r-- | src/main.cpp | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp index 961771c15..0e14876d2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -285,7 +285,7 @@ static void setuidgid() #endif } -void Anope::Init(int ac, char **av) +bool Anope::Init(int ac, char **av) { /* Set file creation mask and group ID. */ #if defined(DEFUMASK) && HAVE_UMASK @@ -300,7 +300,8 @@ void Anope::Init(int ac, char **av) if (GetCommandLineArgument("version", 'v')) { Log(LOG_TERMINAL) << "Anope-" << Anope::Version() << " -- " << Anope::VersionBuildString(); - throw CoreException(); + Anope::ReturnValue = EXIT_SUCCESS; + return false; } if (GetCommandLineArgument("help", 'h')) @@ -326,7 +327,8 @@ void Anope::Init(int ac, char **av) Log(LOG_TERMINAL) << ""; Log(LOG_TERMINAL) << "Further support is available from https://www.anope.org/"; Log(LOG_TERMINAL) << "Or visit us on IRC at irc.anope.org #anope"; - throw CoreException(); + Anope::ReturnValue = EXIT_SUCCESS; + return false; } if (GetCommandLineArgument("nofork", 'n')) @@ -449,7 +451,7 @@ void Anope::Init(int ac, char **av) sigemptyset(&mask); sigsuspend(&mask); - exit(Anope::ReturnValue); + return false; } else if (i == -1) { @@ -560,4 +562,5 @@ void Anope::Init(int ac, char **av) ci->Sync(); Serialize::CheckTypes(); + return true; } diff --git a/src/main.cpp b/src/main.cpp index 5543ceebe..f2228eead 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -137,12 +137,13 @@ int main(int ac, char **av, char **envp) try { /* General initialization first */ - Anope::Init(ac, av); + if (!Anope::Init(ac, av)) + return Anope::ReturnValue; } catch (const CoreException &ex) { Log() << ex.GetReason(); - return -1; + return EXIT_FAILURE; } try |