Ignore:
Timestamp:
May 26, 2010, 1:46:37 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #3235 "Changeset 10293 broke the moving files fron complete to incomplete dir when both dirs have same inode on different devices" -- fixed in trunk for 2.00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r10687 r10692  
    25192519
    25202520static tr_bool
    2521 sameInode( const char * path1, const char * path2 )
    2522 {
    2523     int i1, i2;
     2521isSameLocation( const char * path1, const char * path2 )
     2522{
    25242523    struct stat s1, s2;
    2525 
    2526     s1.st_ino = 1;
    2527     i1 = stat( path1, &s1 );
    2528 
    2529     s2.st_ino = 2;
    2530     i2 = stat( path2, &s2 );
    2531 
    2532     if( !i1 && !i2 ) {
    2533         tr_dbg( "path1 inode is %"PRIu64"; path2 inode is %"PRIu64,
    2534                 (uint64_t)s1.st_ino,
    2535                 (uint64_t)s2.st_ino );
    2536         return s1.st_ino == s2.st_ino;
     2524    const int err1 = stat( path1, &s1 );
     2525    const int err2 = stat( path2, &s2 );
     2526
     2527    if( !err1 && !err2 ) {
     2528        tr_dbg( "path1 dev:inode is %"PRIu64":%"PRIu64"; "
     2529                "path2 dev:inode is %"PRIu64":%"PRIu64,
     2530                (uint64_t)s1.st_dev, (uint64_t)s1.st_ino,
     2531                (uint64_t)s2.st_dev, (uint64_t)s2.st_ino );
     2532        return ( s1.st_dev == s2.st_dev )
     2533            && ( s1.st_ino == s2.st_ino );
    25372534    }
    25382535
    25392536    /* either one, or the other, or both don't exist... */
    2540     tr_dbg( "stat(%s) returned %d\n", path1, i1 );
    2541     tr_dbg( "stat(%s) returned %d\n", path2, i2 );
     2537    tr_dbg( "stat(%s) returned %d\n", path1, err1 );
     2538    tr_dbg( "stat(%s) returned %d\n", path2, err2 );
    25422539    return FALSE;
    25432540}
     
    25612558    tr_mkdirp( location, 0777 );
    25622559
    2563     if( !sameInode( location, tor->currentDir ) )
     2560    if( !isSameLocation( location, tor->currentDir ) )
    25642561    {
    25652562        tr_file_index_t i;
Note: See TracChangeset for help on using the changeset viewer.