1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

(trunk daemon) #3401 "can't set pid option on daemon in settings.json" -- fixed

This commit is contained in:
Charles Kerr 2010-07-07 18:49:06 +00:00
parent af205244d0
commit 674e555182

View file

@ -39,6 +39,7 @@
#define PREF_KEY_DIR_WATCH "watch-dir" #define PREF_KEY_DIR_WATCH "watch-dir"
#define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled" #define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled"
#define PREF_KEY_PIDFILE "pidfile"
#define MEM_K 1024 #define MEM_K 1024
#define MEM_K_STR "KiB" #define MEM_K_STR "KiB"
@ -63,7 +64,6 @@
static tr_bool paused = FALSE; static tr_bool paused = FALSE;
static tr_bool closing = FALSE; static tr_bool closing = FALSE;
static tr_session * mySession = NULL; static tr_session * mySession = NULL;
static const char * pid_filename = NULL;
/*** /***
**** Config File **** Config File
@ -333,6 +333,7 @@ main( int argc, char ** argv )
tr_bool foreground = FALSE; tr_bool foreground = FALSE;
tr_bool dumpSettings = FALSE; tr_bool dumpSettings = FALSE;
const char * configDir = NULL; const char * configDir = NULL;
const char * pid_filename;
dtr_watchdir * watchdir = NULL; dtr_watchdir * watchdir = NULL;
FILE * logfile = NULL; FILE * logfile = NULL;
tr_bool pidfile_created = FALSE; tr_bool pidfile_created = FALSE;
@ -428,7 +429,7 @@ main( int argc, char ** argv )
break; break;
case 954: tr_bencDictAddBool( &settings, TR_PREFS_KEY_RATIO_ENABLED, FALSE ); case 954: tr_bencDictAddBool( &settings, TR_PREFS_KEY_RATIO_ENABLED, FALSE );
break; break;
case 'x': pid_filename = optarg; case 'x': tr_bencDictAddStr( &settings, PREF_KEY_PIDFILE, optarg );
break; break;
case 'y': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LPD_ENABLED, TRUE ); case 'y': tr_bencDictAddBool( &settings, TR_PREFS_KEY_LPD_ENABLED, TRUE );
break; break;
@ -472,6 +473,8 @@ main( int argc, char ** argv )
tr_ninf( NULL, "Using settings from \"%s\"", configDir ); tr_ninf( NULL, "Using settings from \"%s\"", configDir );
tr_sessionSaveSettings( mySession, configDir, &settings ); tr_sessionSaveSettings( mySession, configDir, &settings );
pid_filename = NULL;
tr_bencDictFindStr( &settings, PREF_KEY_PIDFILE, &pid_filename );
if( pid_filename != NULL ) if( pid_filename != NULL )
{ {
FILE * fp = fopen( pid_filename, "w+" ); FILE * fp = fopen( pid_filename, "w+" );