From 36505a8d29683fbb52e7555745dba6bbbf0022e2 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 2 Jan 2009 17:48:20 +0000 Subject: [PATCH] access() is evil and we never want a controlling TTY git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1318 726aef4b-f618-498e-8847-2d620e286838 --- FileUtils.cpp | 5 ++--- FileUtils.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/FileUtils.cpp b/FileUtils.cpp index 88538d91..074265e7 100644 --- a/FileUtils.cpp +++ b/FileUtils.cpp @@ -65,8 +65,6 @@ bool CFile::IsFifo(bool bUseLstat) const { return CFile::IsFifo(m_sLongName, bUs bool CFile::IsLnk(bool bUseLstat) const { return CFile::IsLnk(m_sLongName, bUseLstat); } bool CFile::IsSock(bool bUseLstat) const { return CFile::IsSock(m_sLongName, bUseLstat); } -bool CFile::access(int mode) { return (::access(m_sLongName.c_str(), mode) == 0); } - // for gettin file types, using fstat instead bool CFile::FType(const CString sFileName, EFileTypes eType, bool bUseLstat) { struct stat st; @@ -261,7 +259,8 @@ bool CFile::Open(int iFlags, mode_t iMode) { return false; } - m_iFD = open(m_sLongName.c_str(), iFlags, iMode); + // We never want to get a controlling TTY through this -> O_NOCTTY + m_iFD = open(m_sLongName.c_str(), iFlags | O_NOCTTY, iMode); if (m_iFD < 0) return false; diff --git a/FileUtils.h b/FileUtils.h index 0b1048fa..9192fde5 100644 --- a/FileUtils.h +++ b/FileUtils.h @@ -60,8 +60,6 @@ public: bool IsLnk(bool bUseLstat = true) const; bool IsSock(bool bUseLstat = false) const; - bool access(int mode); - // for gettin file types, using fstat instead static bool FType(const CString sFileName, EFileTypes eType, bool bUseLstat = false);