Remove our only getcwd() call

We now no longer depend on PATH_MAX which is not defined by POSIX.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1286 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-12-07 14:18:23 +00:00
parent c7cf105e15
commit 8db106bf6b
2 changed files with 4 additions and 13 deletions
+4 -7
View File
@@ -398,17 +398,14 @@ bool CZNC::IsHostAllowed(const CString& sHostMask) const {
}
void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) {
char buf[PATH_MAX];
char *home;
if (getcwd(buf, PATH_MAX) == NULL) {
CUtils::PrintError("getcwd() failed, can't read my current dir");
exit(-1);
}
// If the bin was not ran from the current directory, we need to add that dir onto our cwd
CString::size_type uPos = sArgvPath.rfind('/');
m_sCurPath = (uPos == CString::npos) ? CString(buf) : CDir::ChangeDir(buf, sArgvPath.substr(0, uPos), "");
if (uPos == CString::npos)
m_sCurPath = "./";
else
m_sCurPath = CDir::ChangeDir("./", sArgvPath.Left(uPos), "");
// Try to set the user's home dir, default to binpath on failure
home = getenv("HOME");