From 091abed323c11c66d2595280d29be9cc2ac917c4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 7 May 2009 11:54:09 +0000 Subject: [PATCH] (trunk libT) do for tr_close_file() what r8348 did for tr_open_file_for_scanning() --- libtransmission/fdlimit.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index b0ca542ae..8fbe1f97f 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -243,7 +243,11 @@ void tr_close_file( int fd ) { #if defined(HAVE_POSIX_FADVISE) + const int err = errno; + /* Set hint about not caching this file. + It's okay for this to fail silently, so don't let it affect errno */ posix_fadvise( fd, 0, 0, POSIX_FADV_DONTNEED ); + errno = err; #endif close( fd ); }