Changeset 11816


Ignore:
Timestamp:
Feb 2, 2011, 11:19:54 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3973 "JIT verification verifies fresh downloaded torrents" -- win32 portability fix for r11813.

fsync() doesn't exist on Windows. bencode had a private function, tr_fsync(), that is a portability wrapper around fsync() on *nix and _commit() on win32. Make this function package-visible, rather than private, so fdlimit.c can use it too.

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode.c

    r11806 r11816  
    16611661}
    16621662
    1663 /* portability wrapper for fsync(). */
    1664 static void
    1665 tr_fsync( int fd )
    1666 {
    1667 #ifdef WIN32
    1668     _commit( fd );
    1669 #else
    1670     fsync( fd );
    1671 #endif
    1672 }
    1673 
    16741663int
    16751664tr_bencToFile( const tr_benc * top, tr_fmt_mode mode, const char * filename )
  • trunk/libtransmission/fdlimit.c

    r11813 r11816  
    181181}
    182182
     183
     184/* portability wrapper for fsync(). */
     185int
     186tr_fsync( int fd )
     187{
     188#ifdef WIN32
     189    return _commit( fd );
     190#else
     191    return fsync( fd );
     192#endif
     193}
     194
     195
    183196/* Like pread and pwrite, except that the position is undefined afterwards.
    184197   And of course they are not thread-safe. */
     
    296309    fcntl( fd, F_NOCACHE, 1 );
    297310#endif
    298     fsync( fd );
     311    tr_fsync( fd );
    299312    close( fd );
    300313}
  • trunk/libtransmission/fdlimit.h

    r11709 r11816  
    4040
    4141void tr_close_file( int fd );
     42
     43int tr_fsync(int fd);
    4244
    4345ssize_t tr_pread(int fd, void *buf, size_t count, off_t offset);
Note: See TracChangeset for help on using the changeset viewer.