mirror of
https://github.com/transmission/transmission
synced 2024-12-23 16:24:02 +00:00
(trunk libT) #2984 "Transmission 1.91/OSX deletes completed download" -- experimental commit, and more debug messages
This commit is contained in:
parent
58bc905f55
commit
54b394d160
1 changed files with 33 additions and 1 deletions
|
@ -2424,6 +2424,31 @@ struct LocationData
|
||||||
tr_torrent * tor;
|
tr_torrent * tor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static tr_bool
|
||||||
|
sameInode( const char * path1, const char * path2 )
|
||||||
|
{
|
||||||
|
int i1, i2;
|
||||||
|
struct stat s1, s2;
|
||||||
|
|
||||||
|
s1.st_ino = 1;
|
||||||
|
i1 = stat( path1, &s1 );
|
||||||
|
|
||||||
|
s2.st_ino = 2;
|
||||||
|
i2 = stat( path2, &s2 );
|
||||||
|
|
||||||
|
if( !i1 && !i2 ) {
|
||||||
|
tr_dbg( "path1 inode is %"PRIu64"; path2 inode is %"PRIu64,
|
||||||
|
(uint64_t)s1.st_ino,
|
||||||
|
(uint64_t)s2.st_ino );
|
||||||
|
return s1.st_ino == s2.st_ino;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* either one, or the other, or both don't exist... */
|
||||||
|
tr_dbg( "stat(%s) returned %d\n", path1, i1 );
|
||||||
|
tr_dbg( "stat(%s) returned %d\n", path2, i2 );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setLocation( void * vdata )
|
setLocation( void * vdata )
|
||||||
{
|
{
|
||||||
|
@ -2437,7 +2462,12 @@ setLocation( void * vdata )
|
||||||
|
|
||||||
assert( tr_isTorrent( tor ) );
|
assert( tr_isTorrent( tor ) );
|
||||||
|
|
||||||
if( strcmp( location, tor->currentDir ) )
|
tr_dbg( "Moving \"%s\" location from currentDir \"%s\" to \"%s\"",
|
||||||
|
tr_torrentName(tor), tor->currentDir, location );
|
||||||
|
|
||||||
|
tr_mkdirp( location, 0777 );
|
||||||
|
|
||||||
|
if( !sameInode( location, tor->currentDir ) )
|
||||||
{
|
{
|
||||||
tr_file_index_t i;
|
tr_file_index_t i;
|
||||||
|
|
||||||
|
@ -2465,6 +2495,8 @@ setLocation( void * vdata )
|
||||||
char * oldpath = tr_buildPath( oldbase, sub, NULL );
|
char * oldpath = tr_buildPath( oldbase, sub, NULL );
|
||||||
char * newpath = tr_buildPath( location, sub, NULL );
|
char * newpath = tr_buildPath( location, sub, NULL );
|
||||||
|
|
||||||
|
tr_dbg( "Found file #%d: %s", (int)i, oldpath );
|
||||||
|
|
||||||
if( do_move )
|
if( do_move )
|
||||||
{
|
{
|
||||||
tr_bool renamed = FALSE;
|
tr_bool renamed = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue