(trunk daemon) #3394 "crash with last nightly build on Debian X86 #5189" -- fixed

This commit is contained in:
Charles Kerr 2010-07-05 23:36:05 +00:00
parent d4816f7461
commit 7e2175858f
1 changed files with 27 additions and 0 deletions

View File

@ -40,6 +40,24 @@
#define PREF_KEY_DIR_WATCH "watch-dir"
#define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled"
#define MEM_K 1024
#define MEM_B_STR "B"
#define MEM_K_STR "KiB"
#define MEM_M_STR "MiB"
#define MEM_G_STR "GiB"
#define DISK_K 1000
#define DISK_B_STR "B"
#define DISK_K_STR "kB"
#define DISK_M_STR "MB"
#define DISK_G_STR "GB"
#define SPEED_K 1000
#define SPEED_B_STR "B/s"
#define SPEED_K_STR "kB/s"
#define SPEED_M_STR "MB/s"
#define SPEED_G_STR "GB/s"
static tr_bool paused = FALSE;
static tr_bool closing = FALSE;
static tr_session * mySession = NULL;
@ -245,6 +263,12 @@ onFileAdded( tr_session * session, const char * dir, const char * file )
if( remove( filename ) )
tr_err( "Error deleting .torrent file: %s", tr_strerror( errno ) );
}
else
{
char * new_filename = tr_strdup_printf( "%s.added", filename );
rename( filename, new_filename );
tr_free( new_filename );
}
}
}
@ -439,6 +463,9 @@ main( int argc, char ** argv )
}
/* start the session */
tr_formatter_mem_init( MEM_K, MEM_B_STR, MEM_K_STR, MEM_M_STR, MEM_G_STR );
tr_formatter_size_init( DISK_K,DISK_B_STR, DISK_K_STR, DISK_M_STR, DISK_G_STR );
tr_formatter_speed_init( SPEED_K, SPEED_B_STR, SPEED_K_STR, SPEED_M_STR, SPEED_G_STR );
mySession = tr_sessionInit( "daemon", configDir, TRUE, &settings );
tr_ninf( NULL, "Using settings from \"%s\"", configDir );
tr_sessionSaveSettings( mySession, configDir, &settings );