]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Remove dependent commands BEFORE deleting the Module*, otherwise things go tits over...
[user/henk/code/inspircd.git] / src / inspircd.cpp
index a2b4e0d92e2c1e7ea67917c9a3d06196c5787752..3ce2261c54034dde2c5282bdcc9ab42dab575ac3 100644 (file)
@@ -155,13 +155,14 @@ void Rehash(int status)
        FOREACH_MOD(I_OnRehash,OnRehash(""));
 }
 
-void InspIRCd::SetSignals()
+void InspIRCd::SetSignals(bool SEGVHandler)
 {
        signal (SIGALRM, SIG_IGN);
        signal (SIGHUP, Rehash);
        signal (SIGPIPE, SIG_IGN);
        signal (SIGTERM, Exit);
-       signal (SIGSEGV, Error);
+       if (SEGVHandler)
+               signal (SIGSEGV, Error);
 }
 
 bool InspIRCd::DaemonSeed()
@@ -232,6 +233,8 @@ void InspIRCd::MakeLowerMap()
 
 InspIRCd::InspIRCd(int argc, char** argv)
 {
+       bool SEGVHandler = false;
+
        this->Start();
        module_sockets.clear();
        this->startup_time = time(NULL);
@@ -268,6 +271,10 @@ InspIRCd::InspIRCd(int argc, char** argv)
                        {
                                printf("WARNING: The `-nolimit' option is deprecated, and now on by default. This behaviour may change in the future.\n");
                        }
+                       else if (!strcmp(argv[i],"-notraceback"))
+                       {
+                               SEGVHandler = false;
+                       }
                        else if (!strcmp(argv[i],"-logfile"))
                        {
                                if (argc > i+1)
@@ -280,6 +287,12 @@ InspIRCd::InspIRCd(int argc, char** argv)
                                        printf("ERROR: The -logfile parameter must be followed by a log file name and path.\n");
                                        Exit(ERROR);
                                }
+                               i++;
+                       }
+                       else
+                       {
+                               printf("Usage: %s [-nofork] [-nolog] [-debug] [-wait] [-nolimit] [-notraceback] [-logfile <filename>]\n",argv[0]);
+                               Exit(ERROR);
                        }
                }
        }
@@ -292,7 +305,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
        this->stats = new serverstats();
        this->Parser = new CommandParser();
        Config->ClearStack();
-       Config->Read(true,NULL);
+       Config->Read(true, NULL);
        CheckRoot();
        this->ModeGrok = new ModeParser();
        AddServerName(Config->ServerName);
@@ -306,7 +319,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
        memset(&Config->implement_lists,0,sizeof(Config->implement_lists));
 
        printf("\n");
-       this->SetSignals();
+       this->SetSignals(SEGVHandler);
        if (!Config->nofork)
        {
                if (!this->DaemonSeed())
@@ -523,12 +536,12 @@ bool InspIRCd::UnloadModule(const char* filename)
                        }
 
                        // found the module
+                       log(DEBUG,"Removing dependent commands...");
+                       Parser->RemoveCommands(filename);
                        log(DEBUG,"Deleting module...");
                        this->EraseModule(j);
                        log(DEBUG,"Erasing module entry...");
                        this->EraseFactory(j);
-                       log(DEBUG,"Removing dependent commands...");
-                       Parser->RemoveCommands(filename);
                        log(DEFAULT,"Module %s unloaded",filename);
                        MODCOUNT--;
                        BuildISupport();