(trunk libT) silence compiler warning in libtransmission/fdlimit.c: "ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result"

This commit is contained in:
Jordan Lee 2011-02-09 05:34:23 +00:00
parent adf5a2e273
commit 3f9886c3dd
1 changed files with 8 additions and 1 deletions

View File

@ -397,7 +397,14 @@ cached_file_open( struct tr_cached_file * o,
* https://bugs.launchpad.net/ubuntu/+source/transmission/+bug/318249
*/
if( alreadyExisted && ( file_size < (uint64_t)sb.st_size ) )
ftruncate( o->fd, file_size );
{
if( ftruncate( o->fd, file_size ) == -1 )
{
const int err = errno;
tr_err( _( "Couldn't truncate \"%1$s\": %2$s" ), filename, tr_strerror( err ) );
return err;
}
}
if( writable && !alreadyExisted && ( allocation == TR_PREALLOCATE_SPARSE ) )
preallocate_file_sparse( o->fd, file_size );