]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix low risk crash when we can't determine maximum open socket count.
authorPeter Powell <petpow@saberuk.com>
Sun, 7 Jul 2013 15:25:11 +0000 (16:25 +0100)
committerPeter Powell <petpow@saberuk.com>
Sun, 7 Jul 2013 15:25:11 +0000 (16:25 +0100)
src/inspircd.cpp
src/socketengines/socketengine_epoll.cpp
src/socketengines/socketengine_kqueue.cpp
src/socketengines/socketengine_poll.cpp
src/socketengines/socketengine_ports.cpp

index 1403cdef5a5805b10b22c08810839a22cc8a58af..9516449a0858d27e804987ffba7a3106df3cd9f1 100644 (file)
@@ -241,7 +241,7 @@ void InspIRCd::SetSignals()
 
 void InspIRCd::QuickExit(int status)
 {
-       exit(0);
+       exit(status);
 }
 
 bool InspIRCd::DaemonSeed()
index f7e107e7b028cd4db4301b21b56f533117d8d432..6913076a297f5019925494af4d0f9007194c2908 100644 (file)
@@ -63,7 +63,7 @@ EPollEngine::EPollEngine()
        {
                ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
                std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
 
        // This is not a maximum, just a hint at the eventual number of sockets that may be polled.
@@ -75,7 +75,7 @@ EPollEngine::EPollEngine()
                ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now.");
                std::cout << "ERROR: Could not initialize epoll socket engine: " << strerror(errno) << std::endl;
                std::cout << "ERROR: Your kernel probably does not have the proper features. This is a fatal error, exiting now." << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
 
        ref = new EventHandler* [GetMaxFds()];
index e24146943d931b73780a844c04a5cc3a51332efa..8694a0bdd84d4cc2e5249aba5fa4d3f3ed6f5732 100644 (file)
@@ -74,7 +74,7 @@ KQueueEngine::KQueueEngine()
        {
                ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
                std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
 
        this->RecoverFromFork();
@@ -97,7 +97,7 @@ void KQueueEngine::RecoverFromFork()
                ServerInstance->Logs->Log("SOCKET",DEFAULT, "ERROR: this is a fatal error, exiting now.");
                std::cout << "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features." << std::endl;
                std::cout << "ERROR: this is a fatal error, exiting now." << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
        CurrentSetSize = 0;
 }
index 5c361a0cbded453bd9a913f957f4ff31ff02ad73..4f4f60b4e4ed4b4e61633e6492808d850bf72eb9 100644 (file)
@@ -107,7 +107,7 @@ PollEngine::PollEngine()
        {
                ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets: %s", strerror(errno));
                std::cout << "ERROR: Can't determine maximum number of open sockets: " << strerror(errno) << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
 #endif
 
index 52d799ddf286d2689d33879b383e6ff90d2e5c8f..f7c547d4510d79367297db443d3868db868dc579 100644 (file)
@@ -77,7 +77,7 @@ PortsEngine::PortsEngine()
        {
                ServerInstance->Logs->Log("SOCKET", DEFAULT, "ERROR: Can't determine maximum number of open sockets!");
                std::cout << "ERROR: Can't determine maximum number of open sockets!" << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
        EngineHandle = port_create();
 
@@ -87,7 +87,7 @@ PortsEngine::PortsEngine()
                ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: This is a fatal error, exiting now.");
                std::cout << "ERROR: Could not initialize socket engine: " << strerror(errno) << std::endl;
                std::cout << "ERROR: This is a fatal error, exiting now." << std::endl;
-               ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
+               ServerInstance->QuickExit(EXIT_STATUS_SOCKETENGINE);
        }
        CurrentSetSize = 0;