Only posix_fadvise() on close if stream is nonnull, since fileno() segfaults (on Linux) if you try that.
This commit is contained in:
parent
778c397d48
commit
5ffab7f278
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
|
||||
// The developer of the original code and/or files is Tripwire, Inc.
|
||||
// Portions created by Tripwire, Inc. are copyright (C) 2000 Tripwire,
|
||||
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
||||
|
@ -229,12 +229,12 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
void cFile::Close() //throw(eFile)
|
||||
{
|
||||
if(mpData->mpCurrStream != NULL)
|
||||
{
|
||||
#ifdef HAVE_POSIX_FADVISE
|
||||
posix_fadvise(fileno(mpData->mpCurrStream),0,0, POSIX_FADV_DONTNEED);
|
||||
#endif
|
||||
|
||||
if(mpData->mpCurrStream != NULL)
|
||||
{
|
||||
fclose( mpData->mpCurrStream );
|
||||
mpData->mpCurrStream = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue