From 3e1a2d9ea72dd3dbf9562094db4d322c4fc92303 Mon Sep 17 00:00:00 2001 From: dgw Date: Wed, 21 Aug 2013 00:50:15 +0400 Subject: [PATCH] Implement permission inheritance in log module Quick-and-dirty matching of permissions when new log directories are created. Currently gets tripped up by the umask with some perms. --- modules/log.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/log.cpp b/modules/log.cpp index 1fa7c09b..43b82a52 100644 --- a/modules/log.cpp +++ b/modules/log.cpp @@ -97,7 +97,9 @@ void CLogMod::PutLog(const CString& sLine, const CString& sWindow /*= "Status"*/ CFile LogFile(sPath); CString sLogDir = LogFile.GetDir(); - if (!CFile::Exists(sLogDir)) CDir::MakeDir(sLogDir); + struct stat ModDirInfo; + CFile::GetInfo(GetSavePath(), ModDirInfo); + if (!CFile::Exists(sLogDir)) CDir::MakeDir(sLogDir, ModDirInfo.st_mode); if (LogFile.Open(O_WRONLY | O_APPEND | O_CREAT)) { LogFile.Write(CUtils::FormatTime(curtime, "[%H:%M:%S] ", m_pUser->GetTimezone()) + (m_bSanitize ? sLine.StripControls_n() : sLine) + "\n");