From e08cb7264666f7125ad3bcd7ceadb35d7b7f92a7 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 3 Jun 2008 06:32:18 +0000 Subject: [PATCH] Also use /etc/passwd if $HOME is set but empty Before this, we used ./.znc as datadir in this case. Not good. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1081 726aef4b-f618-498e-8847-2d620e286838 --- znc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/znc.cpp b/znc.cpp index 3ac6e8eb..93bd0f2e 100644 --- a/znc.cpp +++ b/znc.cpp @@ -397,9 +397,12 @@ void CZNC::InitDirs(const CString& sArgvPath, const CString& sDataDir) { // Try to set the user's home dir, default to binpath on failure home = getenv("HOME"); + m_sHomePath.clear(); if (home) { m_sHomePath = home; - } else { + } + + if (m_sHomePath.empty()) { struct passwd* pUserInfo = getpwuid(getuid()); if (pUserInfo) {