Changeset 10187


Ignore:
Timestamp:
Feb 12, 2010, 9:06:21 PM (12 years ago)
Author:
charles
Message:

(trunk libT) minor tweak to verify: use tr_pread() instead of lseek+read

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/verify.c

    r10186 r10187  
    7373        int64_t leftInFile;
    7474        int64_t bytesThisPass;
     75        ssize_t numRead;
    7576        const tr_file * file = &tor->info.files[fileIndex];
    7677
     
    109110
    110111        /* read a bit */
    111         if( (fd>=0) && tr_lseek( fd, filePos, SEEK_SET ) != -1 ) {
    112             const int64_t numRead = read( fd, buffer, bytesThisPass );
    113             if( numRead > 0 )
    114                 pieceBytesRead += numRead;
    115             if( numRead == bytesThisPass )
    116                 SHA1_Update( &sha, buffer, numRead );
     112        numRead = tr_pread( fd, buffer, bytesThisPass, filePos );
     113        if( numRead == bytesThisPass )
     114            SHA1_Update( &sha, buffer, numRead );
     115        if( numRead > 0 ) {
     116            pieceBytesRead += numRead;
    117117#if defined HAVE_POSIX_FADVISE && defined POSIX_FADV_DONTNEED
    118118            posix_fadvise( fd, filePos, bytesThisPass, POSIX_FADV_DONTNEED );
    119 #endif
    120 #ifdef SYS_DARWIN
    121             fcntl( fd, F_NOCACHE, 1 );
    122119#endif
    123120        }
Note: See TracChangeset for help on using the changeset viewer.