From 69279c516e11438a0cbe373e88e86e453f61501d Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 31 Dec 2008 14:34:55 +0000 Subject: [PATCH] Use fchmod() instead of chmod() if the file is already open git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1316 726aef4b-f618-498e-8847-2d620e286838 --- FileUtils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FileUtils.cpp b/FileUtils.cpp index 5c484d94..621f287c 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -223,7 +223,10 @@ bool CFile::Copy(const CString& sOldFileName, const CString& sNewFileName, bool } bool CFile::Chmod(mode_t mode) { - return CFile::Chmod(m_sLongName, mode); + if (m_iFD == -1) { + return false; + } + return (fchmod(m_iFD, mode) == 0); } bool CFile::Chmod(const CString& sFile, mode_t mode) {