1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 07:03:44 +00:00

(trunk libT) possible fix for #2030

This commit is contained in:
Charles Kerr 2009-05-06 19:06:19 +00:00
parent 113cb55552
commit c1a8c7363a

View file

@ -223,6 +223,9 @@ tr_open_file_for_scanning( const char * filename )
fd = open( filename, flags, 0666 ); fd = open( filename, flags, 0666 );
if( fd >= 0 ) if( fd >= 0 )
{ {
/* Set hints about the lookahead buffer and caching. It's okay
for these to fail silently, so don't let them affect errno */
const int err = errno;
#ifdef HAVE_POSIX_FADVISE #ifdef HAVE_POSIX_FADVISE
posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL ); posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL );
#endif #endif
@ -230,6 +233,7 @@ tr_open_file_for_scanning( const char * filename )
fcntl( fd, F_NOCACHE, 1 ); fcntl( fd, F_NOCACHE, 1 );
fcntl( fd, F_RDAHEAD, 1 ); fcntl( fd, F_RDAHEAD, 1 );
#endif #endif
errno = err;
} }
return fd; return fd;