(trunk libT) #3622 "verification ignores return value of pread" -- commit fixVerify.patch
This commit is contained in:
parent
458f2d603f
commit
851ed9f929
|
@ -100,12 +100,13 @@ verifyTorrent( tr_torrent * tor, tr_bool * stopFlag )
|
||||||
/* read a bit */
|
/* read a bit */
|
||||||
if( fd >= 0 ) {
|
if( fd >= 0 ) {
|
||||||
const ssize_t numRead = tr_pread( fd, buffer, bytesThisPass, filePos );
|
const ssize_t numRead = tr_pread( fd, buffer, bytesThisPass, filePos );
|
||||||
if( numRead == (ssize_t)bytesThisPass )
|
if( numRead > 0 ) {
|
||||||
SHA1_Update( &sha, buffer, numRead );
|
bytesThisPass = (uint32_t)numRead;
|
||||||
|
SHA1_Update( &sha, buffer, bytesThisPass );
|
||||||
#if defined HAVE_POSIX_FADVISE && defined POSIX_FADV_DONTNEED
|
#if defined HAVE_POSIX_FADVISE && defined POSIX_FADV_DONTNEED
|
||||||
if( numRead > 0 )
|
|
||||||
posix_fadvise( fd, filePos, bytesThisPass, POSIX_FADV_DONTNEED );
|
posix_fadvise( fd, filePos, bytesThisPass, POSIX_FADV_DONTNEED );
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move our offsets */
|
/* move our offsets */
|
||||||
|
|
Loading…
Reference in New Issue