]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/inspircd.cpp
Remove needless chdir() from inspircd executable
[user/henk/code/inspircd.git] / src / inspircd.cpp
index 2a6bc4e0a2e80ecfe37477f1d57e4cffdaa87af8..a932b95e10fe9aeabf4bd162527bd12d32d31370 100644 (file)
@@ -320,13 +320,14 @@ InspIRCd::InspIRCd(int argc, char** argv) :
          * THIS MUST MATCH THE ORDER OF DECLARATION OF THE FUNCTORS, e.g. the methods
          * themselves within the class.
          */
+        NICKForced("NICKForced", NULL),
+        OperQuit("OperQuit", NULL),
         IsChannel(&HandleIsChannel),
         IsSID(&HandleIsSID),
         Rehash(&HandleRehash),
         IsNick(&HandleIsNick),
         IsIdent(&HandleIsIdent),
         FloodQuitUser(&HandleFloodQuitUser)
-
 {
 #ifdef WIN32
        // Strict, frequent checking of memory on debug builds
@@ -338,8 +339,8 @@ InspIRCd::InspIRCd(int argc, char** argv) :
 
        ServerInstance = this;
 
-       Extensible::Register(&User::NICKForced);
-       Extensible::Register(&User::OperQuit);
+       Extensible::Register(&NICKForced);
+       Extensible::Register(&OperQuit);
 
        FailedPortList pl;
        int do_version = 0, do_nofork = 0, do_debug = 0,
@@ -400,15 +401,6 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        this->Config->argv = argv;
        this->Config->argc = argc;
 
-       if (chdir(Config->GetFullProgDir().c_str()))
-       {
-               printf("Unable to change to my directory: %s\nAborted.", strerror(errno));
-               exit(0);
-       }
-
-       this->Config->opertypes.clear();
-       this->Config->operclass.clear();
-
        this->TIME = this->OLDTIME = this->startup_time = time(NULL);
        srand(this->TIME);
 
@@ -567,15 +559,16 @@ InspIRCd::InspIRCd(int argc, char** argv) :
        if (Config->sid.empty())
        {
                // Generate one
-               size_t sid = 0;
+               unsigned int sid = 0;
+               char sidstr[4];
 
                for (const char* x = Config->ServerName.c_str(); *x; ++x)
                        sid = 5 * sid + *x;
                for (const char* y = Config->ServerDesc.c_str(); *y; ++y)
                        sid = 5 * sid + *y;
-               sid = sid % 999;
+               sprintf(sidstr, "%03d", sid % 1000);
 
-               Config->sid = ConvToStr(sid);
+               Config->sid = sidstr;
        }
 
        /* set up fake client again this time with the correct uid */