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 ); }