]> granicus.if.org Git - transmission/commitdiff
(trunk libT) silence compiler warning in libtransmission/fdlimit.c: "ignoring return...
authorJordan Lee <jordan@transmissionbt.com>
Wed, 9 Feb 2011 05:34:23 +0000 (05:34 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Wed, 9 Feb 2011 05:34:23 +0000 (05:34 +0000)
libtransmission/fdlimit.c

index e9dd9d0eb803a42410d79f693937dcba8417bcdf..c80953e4033525d286292ad6e0a077748a40db05 100644 (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 );