Changeset 9333 for trunk/libtransmission/torrent.c
- Timestamp:
- Oct 19, 2009, 1:15:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r9328 r9333 2519 2519 tr_torrentFileCompleted( tr_torrent * tor, tr_file_index_t fileNum ) 2520 2520 { 2521 char * oldpath = tr_torrentFindFile( tor, fileNum ); 2522 char * newpath = tr_strdup( oldpath ); 2523 char * pch = strrchr( newpath, '.' ); 2524 assert( !strcmp( pch, ".part" ) ); 2525 *pch = '\0'; 2521 char * oldpath; 2526 2522 2527 2523 /* close the file so that we can reopen in read-only mode as needed */ 2528 2524 tr_fdFileClose( tor, fileNum ); 2529 2525 2530 /* strip the trailing ".part" from the filename */ 2531 if( rename( oldpath, newpath ) ) 2532 tr_torerr( tor, "Error moving \"%s\" to \"%s\": %s", oldpath, newpath, tr_strerror( errno ) ); 2533 2534 tr_free( newpath ); 2526 /* if the torrent's file ends in ".part" to show that it was incomplete, 2527 * strip that suffix */ 2528 oldpath = tr_torrentFindFile( tor, fileNum ); 2529 if( oldpath != NULL ) { 2530 char * newpath = tr_strdup( oldpath ); 2531 char * pch = strrchr( newpath, '.' ); 2532 if(( pch != NULL ) && !strcmp( pch, ".part" )) { 2533 *pch = '\0'; 2534 if( rename( oldpath, newpath ) ) 2535 tr_torerr( tor, "Error moving \"%s\" to \"%s\": %s", oldpath, newpath, tr_strerror( errno ) ); 2536 } 2537 tr_free( newpath ); 2538 } 2535 2539 tr_free( oldpath ); 2536 2540 }
Note: See TracChangeset
for help on using the changeset viewer.