Ignore:
Timestamp:
Jun 16, 2009, 5:10:47 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2196: add a fallback implementation of preallocateFileFull() in case the os-specific and fs-specific approaches don't work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r8702 r8707  
    184184# endif
    185185
     186        if( !success ) /* if nothing else works, do it the old-fashioned way */
     187        {
     188            uint8_t buf[ 4096 ];
     189            memset( buf, 0, sizeof( buf ) );
     190            success = TRUE;
     191            while ( success && ( length > 0 ) )
     192            {
     193                const int thisPass = MIN( length, sizeof( buf ) );
     194                success = write( fd, buf, thisPass ) == thisPass;
     195                length -= thisPass;
     196            }
     197        }
     198
    186199        close( fd );
    187200    }
Note: See TracChangeset for help on using the changeset viewer.