Ignore:
Timestamp:
Sep 8, 2009, 6:25:40 AM (13 years ago)
Author:
charles
Message:

add better logging to track down tr_ioRead() error messages reported by Rabbitbunny

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/inout.c

    r8935 r9066  
    101101
    102102    if( ( ioMode == TR_IO_READ ) && !fileExists ) /* does file exist? */
     103        err = ENOENT;
     104    else if( ( fd = tr_fdFileCheckout( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 ) {
    103105        err = errno;
    104     else if( ( fd = tr_fdFileCheckout ( tor->uniqueId, tor->downloadDir, file->name, ioMode == TR_IO_WRITE, preallocationMode, file->length ) ) < 0 )
     106        tr_torerr( tor, "tr_fdFileCheckout failed for \"%s\": %s", file->name, tr_strerror( err ) );
     107    }
     108    else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 ) {
    105109        err = errno;
    106     else if( tr_lseek( fd, (int64_t)fileOffset, SEEK_SET ) == -1 )
     110        tr_torerr( tor, "tr_lseek failed for \"%s\": %s", file->name, tr_strerror( err ) );
     111    }
     112    else if( func( fd, buf, buflen ) != buflen ) {
    107113        err = errno;
    108     else if( func( fd, buf, buflen ) != buflen )
    109         err = errno;
     114        tr_torerr( tor, "read/write failed for \"%s\": %s", file->name, tr_strerror( err ) );
     115    }
    110116    else
    111117        err = 0;
     
    176182    {
    177183        const tr_file * file = &info->files[fileIndex];
    178         const uint64_t  bytesThisPass = MIN( buflen, file->length - fileOffset );
     184        const uint64_t bytesThisPass = MIN( buflen, file->length - fileOffset );
    179185
    180186        err = readOrWriteBytes( tor, ioMode, fileIndex, fileOffset, buf, bytesThisPass );
Note: See TracChangeset for help on using the changeset viewer.