Ignore:
Timestamp:
Apr 28, 2011, 6:40:46 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) tr_torrentGetFileMTime(): if the file being looked at is aleady open in fdlimit's file cache, use that cached handle instead of deriving our own.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r12373 r12397  
    562562}
    563563
     564#ifdef SYS_DARWIN
     565 #define TR_STAT_MTIME(sb) ((sb).st_mtimespec.tv_sec)
     566#else
     567 #define TR_STAT_MTIME(sb) ((sb).st_mtime)
     568#endif
     569
     570bool
     571tr_fdFileGetCachedMTime( tr_session * s, int torrent_id, tr_file_index_t i, time_t * mtime )
     572{
     573    bool success;
     574    struct stat sb;
     575    struct tr_cached_file * o = fileset_lookup( get_fileset( s ), torrent_id, i );
     576
     577    if(( success = ( o != NULL ) && !fstat( o->fd, &sb )))
     578        *mtime = TR_STAT_MTIME( sb );
     579
     580    return success;
     581}
     582
    564583void
    565584tr_fdTorrentClose( tr_session * session, int torrent_id )
Note: See TracChangeset for help on using the changeset viewer.