mirror of
https://github.com/znc/znc.git
synced 2026-05-18 07:15:54 +02:00
Make O_RDONLY the default mode when opening files through CFile
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1336 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+1
-1
@@ -164,7 +164,7 @@ CFile* CDCCSock::OpenFile(bool bWrite) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!m_pFile->Open(O_RDONLY)) {
|
||||
if (!m_pFile->Open()) {
|
||||
delete m_pFile;
|
||||
m_pFile = NULL;
|
||||
m_pUser->PutModule(m_sModuleName, "DCC -> [" + m_sRemoteNick + "] - Could not open file [" + m_sLocalFile + "]");
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ bool CFile::Copy(const CString& sOldFileName, const CString& sNewFileName, bool
|
||||
CFile OldFile(sOldFileName);
|
||||
CFile NewFile(sNewFileName);
|
||||
|
||||
if (!OldFile.Open(O_RDONLY)) {
|
||||
if (!OldFile.Open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -106,8 +106,8 @@ public:
|
||||
static bool Chmod(const CString& sFile, mode_t mode);
|
||||
bool Seek(unsigned long uPos);
|
||||
bool Truncate();
|
||||
bool Open(const CString& sFileName, int iFlags, mode_t iMode = 0644);
|
||||
bool Open(int iFlags, mode_t iMode = 0644);
|
||||
bool Open(const CString& sFileName, int iFlags = O_RDONLY, mode_t iMode = 0644);
|
||||
bool Open(int iFlags = O_RDONLY, mode_t iMode = 0644);
|
||||
int Read(char *pszBuffer, int iBytes);
|
||||
bool ReadLine(CString & sData, const CString & sDelimiter = "\n");
|
||||
bool ReadFile(CString& sData, size_t iMaxSize = 512 * 1024);
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ bool CTemplate::Print(const CString& sFileName, ostream& oOut) {
|
||||
|
||||
CFile File(sFileName);
|
||||
|
||||
if (!File.Open(O_RDONLY)) {
|
||||
if (!File.Open()) {
|
||||
DEBUG_ONLY(cerr << "Unable to open file [" << sFileName << "] in CTemplate::Print()" << endl);
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -387,7 +387,7 @@ private:
|
||||
|
||||
CFile File(sMessages);
|
||||
|
||||
if (sMessages.empty() || !File.Open(O_RDONLY) || !File.ReadFile(sFile))
|
||||
if (sMessages.empty() || !File.Open() || !File.ReadFile(sFile))
|
||||
{
|
||||
PutModule("Unable to find buffer");
|
||||
return(true); // gonna be successful here
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ public:
|
||||
|
||||
CString sBuffer, sScript;
|
||||
CFile cFile(sModule);
|
||||
if (!cFile.Exists() || !cFile.Open(O_RDONLY))
|
||||
if (!cFile.Exists() || !cFile.Open())
|
||||
return false;
|
||||
|
||||
while (cFile.ReadLine(sBuffer))
|
||||
|
||||
@@ -304,7 +304,7 @@ private:
|
||||
|
||||
CFile File(sChannel);
|
||||
|
||||
if (sChannel.empty() || !File.Open(O_RDONLY) || !File.ReadFile(sFile))
|
||||
if (sChannel.empty() || !File.Open() || !File.ReadFile(sFile))
|
||||
return(true); // gonna be successful here
|
||||
|
||||
File.Close();
|
||||
|
||||
Reference in New Issue
Block a user