[or-cvs] make pidfile default to null rather than writing to your cwd

Roger Dingledine arma at seul.org
Wed Nov 19 22:45:09 UTC 2003


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	config.c main.c 
Log Message:
make pidfile default to null rather than writing to your cwd


Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- config.c	17 Nov 2003 07:43:03 -0000	1.69
+++ config.c	19 Nov 2003 22:45:06 -0000	1.70
@@ -259,7 +259,7 @@
   options->DirBindAddress = tor_strdup("0.0.0.0");
   options->RecommendedVersions = tor_strdup("none");
   options->loglevel = LOG_INFO;
-  options->PidFile = tor_strdup("tor.pid");
+  options->PidFile = NULL; // tor_strdup("tor.pid");
   options->DataDirectory = NULL;
   options->PathlenCoinWeight = 0.3;
   options->MaxConn = 900;

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- main.c	19 Nov 2003 02:22:52 -0000	1.151
+++ main.c	19 Nov 2003 22:45:06 -0000	1.152
@@ -628,8 +628,8 @@
   }
 
   /* write our pid to the pid file, if we do not have write permissions we will log a warning */
-  write_pidfile(options.PidFile);
-  /* XXX Is overwriting the pidfile ok? I think it is. -RD */
+  if(options.PidFile)
+    write_pidfile(options.PidFile);
 
   return 0;
 }
@@ -750,7 +750,8 @@
       log(LOG_ERR,"Catching signal %d, exiting cleanly.", the_signal);
       /* we don't care if there was an error when we unlink, nothing
          we could do about it anyways */
-      unlink(options.PidFile);
+      if(options.PidFile)
+        unlink(options.PidFile);
       exit(0);
     case SIGHUP:
       please_reset = 1;



More information about the tor-commits mailing list