mirror of
https://github.com/znc/znc.git
synced 2026-08-02 15:03:16 +02:00
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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user