Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bramswenson/405463 to your computer and use it in GitHub Desktop.
Save bramswenson/405463 to your computer and use it in GitHub Desktop.
--- transmission-1.92.orig/daemon/daemon.c 2010-05-18 15:14:58.346494098 -0400
+++ transmission-1.92/daemon/daemon.c.1.92 2010-05-18 10:16:47.866492702 -0400
@@ -43,6 +43,7 @@
static tr_bool paused = FALSE;
static tr_bool closing = FALSE;
static tr_session * mySession = NULL;
+char *PIDFILE;
/***
**** Config File
@@ -98,6 +99,7 @@
{ 'r', "rpc-bind-address", "Where to listen for RPC connections", "r", 1, "<ipv4 address>" },
{ 953, "global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" },
{ 954, "no-global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL },
+ { 'x', "pid-file", "Set PID file ", "x", 1, "<pid-file>" },
{ 0, NULL, NULL, NULL, 0, NULL }
};
@@ -389,6 +391,9 @@
case 954:
tr_bencDictAddBool( &settings, TR_PREFS_KEY_RATIO_ENABLED, FALSE );
break;
+ case 'x':
+ PIDFILE = optarg;
+ break;
default: showUsage( );
break;
}
@@ -424,6 +429,11 @@
tr_ninf( NULL, "Using settings from \"%s\"", configDir );
tr_sessionSaveSettings( mySession, configDir, &settings );
+ FILE *pid_file;
+ pid_file=fopen(PIDFILE, "w");
+ fprintf (pid_file, "%d", getpid());
+ fclose (pid_file);
+
if( tr_bencDictFindBool( &settings, TR_PREFS_KEY_RPC_AUTH_REQUIRED, &boolVal ) && boolVal )
tr_ninf( MY_NAME, "requiring authentication" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment