]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
- Modify ServerConfig::GetFullProgDir to just return cwd, previously it did a lot...
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 20 May 2007 12:54:57 +0000 (12:54 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 20 May 2007 12:54:57 +0000 (12:54 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7063 e03df62e-2008-0410-955e-edbf42e46eb7

include/configreader.h
src/configreader.cpp
src/helperfuncs.cpp

index 096d1843afaabaf9e83a071d04d08003518b9607..d8d0a93d2cd45827d30229dd93bd43f39d7d4211 100644 (file)
@@ -656,7 +656,7 @@ class CoreExport ServerConfig : public Extensible
        bool AddIOHook(Module* iomod, InspSocket* is);
        bool DelIOHook(InspSocket* is);
 
-       static std::string GetFullProgDir(char** argv, int argc);
+       static std::string GetFullProgDir();
        static bool DirValid(const char* dirandfile);
        static char* CleanFilename(char* name);
        static bool FileExists(const char* file);
index 4d4dccb083c0dbee02aef9d2644fb2757d042846..8e785a1e47147c547c7fd8bb899f68e0140ffe31 100644 (file)
@@ -1593,42 +1593,22 @@ bool ServerConfig::DirValid(const char* dirandfile)
        }
 }
 
-std::string ServerConfig::GetFullProgDir(char** argv, int argc)
+std::string ServerConfig::GetFullProgDir()
 {
-       char work[1024];
        char buffer[1024];
-       char otherdir[1024];
-       int p;
-
-       strlcpy(work,argv[0],1024);
-       p = strlen(work);
-
-       // we just want the dir
-       while (*work)
-       {
-               if ((work[p] == '/') || (work[p] == '\\'))
-               {
-                       work[p] = '\0';
-                       break;
-               }
-
-               work[p--] = '\0';
-       }
 
        // Get the current working directory
        if (getcwd(buffer, 1024) == NULL)
+       {
                return "";
-
-       if (chdir(work) == -1)
-               return "";
-
-       if (getcwd(otherdir, 1024) == NULL)
-               return "";
+       }
 
        if (chdir(buffer) == -1)
+       {
                return "";
+       }
 
-       return otherdir;
+       return buffer;
 }
 
 InspIRCd* ServerConfig::GetInstance()
index d79b18c9ddc5eed71c7f8abd3c1606cb90629549..03d6879baf814540367909f9070d1e5f56677b6e 100644 (file)
@@ -431,7 +431,7 @@ bool InspIRCd::IsIdent(const char* n)
 
 void InspIRCd::OpenLog(char** argv, int argc)
 {
-       Config->MyDir = ServerConfig::GetFullProgDir(argv,argc);
+       Config->MyDir = ServerConfig::GetFullProgDir();
 
        if (!*this->LogFileName)
        {