diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-26 19:51:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-26 19:51:24 +0000 |
commit | 5e14a1bbf45f1cb8edc1c14d4a7f20e26a29d02b (patch) | |
tree | 93a9468e245d90026b73bc440fdb7121b6a889a6 /src/configreader.cpp | |
parent | 2023652459c4a1ae5cb9d45b54f2f24795b98f9b (diff) |
w00t please review, line 1603 configreader.cpp
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7154 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r-- | src/configreader.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index bb22db3b1..d35e1f5fe 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -1605,17 +1605,18 @@ std::string ServerConfig::GetFullProgDir() char buffer[1024]; // Get the current working directory - if (getcwd(buffer, 1024) == NULL) + if (getcwd(buffer, 1024)) { - return ""; - } + std::string remainder = this->argv[0]; - if (chdir(buffer) == -1) - { - return ""; + /* Does argv[0] start with /? its a full path, use it */ + if (remainder[0] == '/') + return remainder; + + return std::string(buffer) + "/" + remainder; } - return buffer; + return "/"; } InspIRCd* ServerConfig::GetInstance() |