From: <ps...@us...> - 2009-01-28 09:55:38
|
Revision: 1354 http://znc.svn.sourceforge.net/znc/?rev=1354&view=rev Author: psychon Date: 2009-01-28 09:55:32 +0000 (Wed, 28 Jan 2009) Log Message: ----------- Use O_BINARY when opening files if it is available Modified Paths: -------------- trunk/FileUtils.cpp Modified: trunk/FileUtils.cpp =================================================================== --- trunk/FileUtils.cpp 2009-01-27 19:56:05 UTC (rev 1353) +++ trunk/FileUtils.cpp 2009-01-28 09:55:32 UTC (rev 1354) @@ -16,6 +16,10 @@ # define lstat(a, b) stat(a, b) #endif +#ifndef O_BINARY +# define O_BINARY 0 +#endif + CFile::CFile() { m_iFD = -1; m_bClose = false; @@ -264,7 +268,13 @@ } // We never want to get a controlling TTY through this -> O_NOCTTY - m_iFD = open(m_sLongName.c_str(), iFlags | O_NOCTTY, iMode); + iMode |= 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; + + m_iFD = open(m_sLongName.c_str(), iFlags, iMode); if (m_iFD < 0) return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |