(trunk libT) #3622 "verification ignores return value of pread" -- commit fixVerify.patch

This commit is contained in:
Charles Kerr 2010-10-19 13:56:58 +00:00
parent 458f2d603f
commit 851ed9f929
1 changed files with 4 additions and 3 deletions

View File

@ -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 */