diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-23 16:40:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-23 16:40:09 +0000 |
commit | de3978c580edabe667d0845ed6027c9ff25e461b (patch) | |
tree | 1d49d99735e1b3ef50a5b42bee950e534ccabdf0 /src/inspircd.cpp | |
parent | e04f190f6377e76d2f3c5b0ece40507f19531ae7 (diff) |
Fix bug in m_dnsbl, a condition is always matched because someone was using unsigned int to check a return val that can be -1 *slap w00t*
Change around the way exit codes are formed so that we can return a sensible exit code that reflects why inspircd exited
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6076 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 29b2105ce..ab438df16 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -25,6 +25,7 @@ #include "socket.h" #include "typedefs.h" #include "command_parse.h" +#include "exitcodes.h" #include <dlfcn.h> using irc::sockets::NonBlocking; @@ -65,10 +66,9 @@ void InspIRCd::Exit(int status) { if (SI) { - SI->SendError("Exiting with status " + ConvToStr(status)); + SI->SendError("Exiting with status " + ConvToStr(status) + " (" + std::string(ExitCodes[status]) + ")"); SI->Cleanup(); } - exit (status); } @@ -167,7 +167,7 @@ bool InspIRCd::DaemonSeed() */ while (kill(childpid, 0) != -1) sleep(1); - exit(ERROR); + Exit(EXIT_STATUS_FORK); } setsid (); umask (007); @@ -212,7 +212,7 @@ void InspIRCd::WritePID(const std::string &filename) { printf("Failed to write PID-file '%s', exiting.\n",fname.c_str()); this->Log(DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str()); - Exit(0); + Exit(EXIT_STATUS_PID); } } @@ -245,7 +245,7 @@ InspIRCd::InspIRCd(int argc, char** argv) printf("ERROR: Cannot open config file: %s\nExiting...\n",CONFIG_FILE); this->Log(DEFAULT,"main: no config"); printf("ERROR: Your config file is missing, this IRCd will self destruct in 10 seconds!\n"); - Exit(ERROR); + Exit(EXIT_STATUS_CONFIG); } *this->LogFileName = 0; if (argc > 1) { @@ -277,14 +277,14 @@ InspIRCd::InspIRCd(int argc, char** argv) else { printf("ERROR: The -logfile parameter must be followed by a log file name and path.\n"); - Exit(ERROR); + Exit(EXIT_STATUS_CONFIG); } i++; } else { printf("Usage: %s [-nofork] [-nolog] [-debug] [-wait] [-logfile <filename>]\n",argv[0]); - Exit(ERROR); + Exit(EXIT_STATUS_ARGV); } } } @@ -317,7 +317,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if (!this->DaemonSeed()) { printf("ERROR: could not go into daemon mode. Shutting down.\n"); - Exit(ERROR); + Exit(EXIT_STATUS_FORK); } } @@ -337,7 +337,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if ((stats->BoundPortCount == 0) && (found_ports > 0)) { printf("\nERROR: I couldn't bind any ports! Are you sure you didn't start InspIRCd twice?\n"); - Exit(ERROR); + Exit(EXIT_STATUS_BIND); } if (stats->BoundPortCount != (unsigned int)found_ports) @@ -361,7 +361,7 @@ InspIRCd::InspIRCd(int argc, char** argv) if (!SE->AddFd(Config->openSockfd[count])) { printf("\nEH? Could not add listener to socketengine. You screwed up, aborting.\n"); - Exit(ERROR); + Exit(EXIT_STATUS_INTERNAL); } } |