summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/configreader.h2
-rw-r--r--src/configreader.cpp32
-rw-r--r--src/helperfuncs.cpp2
3 files changed, 8 insertions, 28 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 096d1843a..d8d0a93d2 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -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);
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 4d4dccb08..8e785a1e4 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -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()
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index d79b18c9d..03d6879ba 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -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)
{