1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 05:53:12 +02:00

Use normal exit codes when exiting the process.

This commit is contained in:
Sadie Powell
2024-01-05 11:55:20 +00:00
parent a40f8e0b9d
commit 4573e1925d
4 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -416,7 +416,7 @@ namespace Anope
* initializing language support, loading modules, and loading databases.
* @throws CoreException if something bad went wrong
*/
extern void Init(int ac, char **av);
extern bool Init(int ac, char **av);
/** Calls the save database event
*/
+5 -5
View File
@@ -172,19 +172,19 @@ int main(int argc, char *argv[])
std::map<std::string, std::string> versions, old_versions;
if (!read_version_sh(version_sh, versions))
return -1;
return EXIT_FAILURE;
std::string git_version = get_git_hash(git_dir);
if (!write_build_h(buildh, git_version))
return -1;
return EXIT_FAILURE;
read_version_h(versionh, old_versions);
if (versions == old_versions)
return 0;
return EXIT_SUCCESS;
if (!write_version_h(versionh, versions))
return -1;
return EXIT_FAILURE;
return 0;
return EXIT_SUCCESS;
}
+7 -4
View File
@@ -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;
}
+3 -2
View File
@@ -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