Changeset 9251


Ignore:
Timestamp:
Oct 7, 2009, 3:49:55 AM (13 years ago)
Author:
charles
Message:

(trunk libT) #2393: Transmission deletes all files when moving to the same physical directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r9230 r9251  
    23212321setLocation( void * vdata )
    23222322{
    2323     int err = 0;
     2323    tr_bool err = FALSE;
     2324    tr_bool verify_needed = FALSE;
    23242325    struct LocationData * data = vdata;
    23252326    tr_torrent * tor = data->tor;
     
    23592360                errno = 0;
    23602361                tr_torinf( tor, "moving \"%s\" to \"%s\"", oldpath, newpath );
    2361                 if( tr_moveFile( oldpath, newpath ) ) {
    2362                     err = 1;
    2363                     tr_torerr( tor, "error moving \"%s\" to \"%s\": %s",
    2364                                     oldpath, newpath, tr_strerror( errno ) );
     2362                if( rename( oldpath, newpath ) )
     2363                {
     2364                    verify_needed = TRUE;
     2365                    if( tr_moveFile( oldpath, newpath ) )
     2366                    {
     2367                        err = TRUE;
     2368                        tr_torerr( tor, "error moving \"%s\" to \"%s\": %s",
     2369                                        oldpath, newpath, tr_strerror( errno ) );
     2370                    }
    23652371                }
    23662372            }
     
    23832389        {
    23842390            /* blow away the leftover subdirectories in the old location */
    2385             if( do_move )
     2391            if( do_move && verify_needed )
    23862392                tr_torrentDeleteLocalData( tor, remove );
    23872393
    23882394            /* set the new location and reverify */
    23892395            tr_torrentSetDownloadDir( tor, location );
    2390             tr_torrentVerify( tor );
     2396            if( verify_needed )
     2397                tr_torrentVerify( tor );
    23912398        }
    23922399    }
Note: See TracChangeset for help on using the changeset viewer.