]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Get rid of InspIRCd::QuickExit.
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 542789c7ea2c76d79245fb1f998741e6a952b628..a671c3d7b2872602a5b50b2e7f28ca843769765c 100644 (file)
        #include <sys/resource.h>
        #include <dlfcn.h>
        #include <getopt.h>
-
-       /* Some systems don't define RUSAGE_SELF. This should fix them. */
-       #ifndef RUSAGE_SELF
-               #define RUSAGE_SELF 0
-       #endif
-
        #include <pwd.h> // setuid
        #include <grp.h> // setgid
 #else
@@ -138,15 +132,10 @@ void InspIRCd::SetSignals()
        signal(SIGTERM, InspIRCd::SetSignal);
 }
 
-void InspIRCd::QuickExit(int status)
-{
-       exit(status);
-}
-
 // Required for returning the proper value of EXIT_SUCCESS for the parent process
 static void VoidSignalHandler(int signalreceived)
 {
-       exit(0);
+       exit(EXIT_STATUS_NOERROR);
 }
 
 bool InspIRCd::DaemonSeed()
@@ -155,7 +144,7 @@ bool InspIRCd::DaemonSeed()
        std::cout << "InspIRCd Process ID: " << con_green << GetCurrentProcessId() << con_reset << std::endl;
        return true;
 #else
-       // Do not use QuickExit here: It will exit with status SIGTERM which would break e.g. daemon scripts
+       // Do not use exit() here: It will exit with status SIGTERM which would break e.g. daemon scripts
        signal(SIGTERM, VoidSignalHandler);
 
        int childpid = fork();
@@ -172,7 +161,7 @@ bool InspIRCd::DaemonSeed()
                 */
                while (kill(childpid, 0) != -1)
                        sleep(1);
-               exit(0);
+               exit(EXIT_STATUS_NOERROR);
        }
        setsid ();
        std::cout << "InspIRCd Process ID: " << con_green << getpid() << con_reset << std::endl;
@@ -226,8 +215,8 @@ InspIRCd::InspIRCd(int argc, char** argv) :
          * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods
          * themselves within the class.
          */
-        GenRandom(&HandleGenRandom),
-        IsChannel(&HandleIsChannel),
+        GenRandom(&DefaultGenRandom),
+        IsChannel(&DefaultIsChannel),
         IsNick(&DefaultIsNick),
         IsIdent(&DefaultIsIdent)
 {
@@ -404,7 +393,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->Config->Read();
        this->Config->Apply(NULL, "");
        Logs->OpenFileLogs();
-       ModeParser::InitBuiltinModes();
 
        // If we don't have a SID, generate one based on the server name and the server description
        if (Config->sid.empty())
@@ -510,20 +498,20 @@ InspIRCd::InspIRCd(int argc, char** argv) :
                if (setgroups(0, NULL) == -1)
                {
                        this->Logs->Log("STARTUP", LOG_DEFAULT, "setgroups() failed (wtf?): %s", strerror(errno));
-                       this->QuickExit(0);
+                       exit(EXIT_STATUS_CONFIG);
                }
 
                struct group* g = getgrnam(SetGroup.c_str());
                if (!g)
                {
                        this->Logs->Log("STARTUP", LOG_DEFAULT, "getgrnam(%s) failed (wrong group?): %s", SetGroup.c_str(), strerror(errno));
-                       this->QuickExit(0);
+                       exit(EXIT_STATUS_CONFIG);
                }
 
                if (setgid(g->gr_gid) == -1)
                {
                        this->Logs->Log("STARTUP", LOG_DEFAULT, "setgid(%d) failed (wrong group?): %s", g->gr_gid, strerror(errno));
-                       this->QuickExit(0);
+                       exit(EXIT_STATUS_CONFIG);
                }
        }
 
@@ -535,13 +523,13 @@ InspIRCd::InspIRCd(int argc, char** argv) :
                if (!u)
                {
                        this->Logs->Log("STARTUP", LOG_DEFAULT, "getpwnam(%s) failed (wrong user?): %s", SetUser.c_str(), strerror(errno));
-                       this->QuickExit(0);
+                       exit(EXIT_STATUS_CONFIG);
                }
 
                if (setuid(u->pw_uid) == -1)
                {
                        this->Logs->Log("STARTUP", LOG_DEFAULT, "setuid(%d) failed (wrong user?): %s", u->pw_uid, strerror(errno));
-                       this->QuickExit(0);
+                       exit(EXIT_STATUS_CONFIG);
                }
        }