From 5e14a1bbf45f1cb8edc1c14d4a7f20e26a29d02b Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 26 May 2007 19:51:24 +0000 Subject: w00t please review, line 1603 configreader.cpp git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7154 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') 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() -- cgit v1.2.3