Honor the --localstatedir option to configure, instead of hardcoded /var.
[tinc] / src / tincd.c
index 0b02aad..d2ce14d 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: tincd.c,v 1.10.4.30 2000/11/16 22:12:23 zarq Exp $
+    $Id: tincd.c,v 1.10.4.33 2000/11/22 16:19:07 zarq Exp $
 */
 
 #include "config.h"
 */
 
 #include "config.h"
@@ -64,6 +64,7 @@
 #include "conf.h"
 #include "net.h"
 #include "netutl.h"
 #include "conf.h"
 #include "net.h"
 #include "netutl.h"
+#include "process.h"
 #include "protocol.h"
 #include "subnet.h"
 
 #include "protocol.h"
 #include "subnet.h"
 
@@ -247,7 +248,7 @@ void make_names(void)
   if(netname)
     {
       if(!pidfilename)
   if(netname)
     {
       if(!pidfilename)
-        asprintf(&pidfilename, "/var/run/tinc.%s.pid", netname);
+        asprintf(&pidfilename, LOCALSTATEDIR "/run/tinc.%s.pid", netname);
       if(!confbase)
         asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname);
       else
       if(!confbase)
         asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname);
       else
@@ -258,7 +259,7 @@ void make_names(void)
   else
     {
       if(!pidfilename)
   else
     {
       if(!pidfilename)
-        pidfilename = "/var/run/tinc.pid";
+        pidfilename = LOCALSTATEDIR "/run/tinc.pid";
       if(!confbase)
         asprintf(&confbase, "%s/tinc", CONFDIR);
       if(!identname)
       if(!confbase)
         asprintf(&confbase, "%s/tinc", CONFDIR);
       if(!identname)
@@ -320,6 +321,8 @@ main(int argc, char **argv, char **envp)
   if(read_server_config())
     return 1;
 
   if(read_server_config())
     return 1;
 
+  init_processes();
+
   if(detach())
     exit(0);
 
   if(detach())
     exit(0);