From 6362844853cc648b775af5401e5df1b6d0860925 Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Fri, 9 Feb 2018 22:25:06 +0000 Subject: [PATCH] Stop creating files with odd permissions. bits are being set in file mode rather than open flags. As a result file permissions get strange bits set. ``` build# ls -l /etc/opt/znc/znc.conf -rwS------ 1 znc znc 1.62K Feb 9 14:47 /var/opt/ooce/znc/configs/znc.conf build# stat -c %a /etc/opt/znc/znc.conf 4600 ``` --- src/FileUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FileUtils.cpp b/src/FileUtils.cpp index dcc7179a..1ac172ba 100644 --- a/src/FileUtils.cpp +++ b/src/FileUtils.cpp @@ -352,11 +352,11 @@ bool CFile::Open(int iFlags, mode_t iMode) { } // We never want to get a controlling TTY through this -> O_NOCTTY - iMode |= O_NOCTTY; + iFlags |= O_NOCTTY; // Some weird OS from MS needs O_BINARY or else it generates fake EOFs // when reading ^Z from a file. - iMode |= O_BINARY; + iFlags |= O_BINARY; m_iFD = open(m_sLongName.c_str(), iFlags, iMode); if (m_iFD < 0) {