From 851ed9f929a9efc7cf9d4b64efd11217e51392ba Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 19 Oct 2010 13:56:58 +0000 Subject: [PATCH] (trunk libT) #3622 "verification ignores return value of pread" -- commit fixVerify.patch --- libtransmission/verify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libtransmission/verify.c b/libtransmission/verify.c index 6c6c8123b..4826ac723 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.c @@ -100,12 +100,13 @@ verifyTorrent( tr_torrent * tor, tr_bool * stopFlag ) /* read a bit */ if( fd >= 0 ) { const ssize_t numRead = tr_pread( fd, buffer, bytesThisPass, filePos ); - if( numRead == (ssize_t)bytesThisPass ) - SHA1_Update( &sha, buffer, numRead ); + if( numRead > 0 ) { + bytesThisPass = (uint32_t)numRead; + SHA1_Update( &sha, buffer, bytesThisPass ); #if defined HAVE_POSIX_FADVISE && defined POSIX_FADV_DONTNEED - if( numRead > 0 ) posix_fadvise( fd, filePos, bytesThisPass, POSIX_FADV_DONTNEED ); #endif + } } /* move our offsets */