(trunk libT) #2595: "file too large error?" -- this can generate an EFBIG warning sparse preallocation is on and the peer makes an invalid request. At worst this kind of oddball case should generate a debug message notice, not a torrent error. Reported by Waldorf.

This commit is contained in:
Charles Kerr 2009-11-25 19:26:30 +00:00
parent 04011d212b
commit cf69b11031
2 changed files with 10 additions and 13 deletions

View File

@ -146,28 +146,28 @@ readOrWriteBytes( tr_session * session,
if( !err )
{
if( ioMode == TR_IO_READ ) {
int rc = tr_pread(fd, buf, buflen, fileOffset);
if(rc < 0) {
const int rc = tr_pread( fd, buf, buflen, fileOffset );
if( rc < 0 ) {
err = errno;
tr_torerr( tor, "read failed for \"%s\": %s",
file->name, tr_strerror( err ) );
}
} else if( ioMode == TR_IO_PREFETCH ) {
int rc = tr_prefetch(fd, fileOffset, buflen);
if(rc < 0) {
err = errno;
tr_torerr( tor, "prefetch failed for \"%s\": %s",
const int rc = tr_prefetch( fd, fileOffset, buflen );
if( rc < 0 ) {
tr_tordbg( tor, "prefetch failed for \"%s\": %s",
file->name, tr_strerror( err ) );
}
} else if( ioMode == TR_IO_WRITE ) {
int rc = tr_pwrite(fd, buf, buflen, fileOffset);
if(rc < 0) {
const int rc = tr_pwrite( fd, buf, buflen, fileOffset );
if( rc < 0 ) {
err = errno;
tr_torerr( tor, "write failed for \"%s\": %s",
file->name, tr_strerror( err ) );
}
} else
} else {
abort();
}
}
return err;

View File

@ -824,10 +824,7 @@ tr_wait( uint64_t delay_milliseconds )
***/
int
tr_snprintf( char * buf,
size_t buflen,
const char * fmt,
... )
tr_snprintf( char * buf, size_t buflen, const char * fmt, ... )
{
int len;
va_list args;