Changeset 9362 for branches


Ignore:
Timestamp:
Oct 22, 2009, 2:40:22 AM (13 years ago)
Author:
charles
Message:

(1.7x) backports for 1.76: r9251 #2393 possible dataloss when trying to move torrents to the directory they're already in :/

Location:
branches/1.7x
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.7x/NEWS

    r9361 r9362  
    11=== Transmission 1.76 (2009/09/13) ===
    22==== All Platforms ====
     3  * Fix possible dataloss when trying to move torrents to where they already are
    34  * Fix manpage errors
    45  * Use automake's "quieter builds" rule when available
  • branches/1.7x/libtransmission/torrent.c

    r9361 r9362  
    23072307setLocation( void * vdata )
    23082308{
    2309     int err = 0;
     2309    tr_bool err = FALSE;
     2310    tr_bool verify_needed = FALSE;
    23102311    struct LocationData * data = vdata;
    23112312    tr_torrent * tor = data->tor;
     
    23452346                errno = 0;
    23462347                tr_torinf( tor, "moving \"%s\" to \"%s\"", oldpath, newpath );
    2347                 if( tr_moveFile( oldpath, newpath ) ) {
    2348                     err = 1;
    2349                     tr_torerr( tor, "error moving \"%s\" to \"%s\": %s",
    2350                                     oldpath, newpath, tr_strerror( errno ) );
     2348                if( rename( oldpath, newpath ) )
     2349                {
     2350                    verify_needed = TRUE;
     2351                    if( tr_moveFile( oldpath, newpath ) )
     2352                    {
     2353                        err = TRUE;
     2354                        tr_torerr( tor, "error moving \"%s\" to \"%s\": %s",
     2355                                        oldpath, newpath, tr_strerror( errno ) );
     2356                    }
    23512357                }
    23522358            }
     
    23692375        {
    23702376            /* blow away the leftover subdirectories in the old location */
    2371             if( do_move )
     2377            if( do_move && verify_needed )
    23722378                tr_torrentDeleteLocalData( tor, remove );
    23732379
    23742380            /* set the new location and reverify */
    23752381            tr_torrentSetDownloadDir( tor, location );
    2376             tr_torrentVerify( tor );
     2382            if( verify_needed )
     2383                tr_torrentVerify( tor );
    23772384        }
    23782385    }
Note: See TracChangeset for help on using the changeset viewer.