(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

This commit is contained in:
Charles Kerr 2010-05-26 13:46:37 +00:00
parent ad5acbab95
commit 52d82cee33
1 changed files with 13 additions and 16 deletions

View File

@ -2518,27 +2518,24 @@ struct LocationData
};
static tr_bool
sameInode( const char * path1, const char * path2 )
isSameLocation( const char * path1, const char * path2 )
{
int i1, i2;
struct stat s1, s2;
const int err1 = stat( path1, &s1 );
const int err2 = stat( path2, &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;
if( !err1 && !err2 ) {
tr_dbg( "path1 dev:inode is %"PRIu64":%"PRIu64"; "
"path2 dev:inode is %"PRIu64":%"PRIu64,
(uint64_t)s1.st_dev, (uint64_t)s1.st_ino,
(uint64_t)s2.st_dev, (uint64_t)s2.st_ino );
return ( s1.st_dev == s2.st_dev )
&& ( 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 );
tr_dbg( "stat(%s) returned %d\n", path1, err1 );
tr_dbg( "stat(%s) returned %d\n", path2, err2 );
return FALSE;
}
@ -2560,7 +2557,7 @@ setLocation( void * vdata )
tr_mkdirp( location, 0777 );
if( !sameInode( location, tor->currentDir ) )
if( !isSameLocation( location, tor->currentDir ) )
{
tr_file_index_t i;