diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-12-20 22:03:54 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2005-12-20 22:03:54 +0000 |
commit | 22a0b2f80b4063ee265465ca1295afddc34f4032 (patch) | |
tree | 4d0692ea10111c9e4d69ca70fbd7ba970853dc8b /sbin/isakmpd/isakmpd.c | |
parent | 4f534027992d1c99ed7bd2d0a39f727c4762c7ed (diff) |
let isakmpd(8) remove it's pid/fifo file on exit.
rework signal handling in the monitor process to
let this work. testing and ok hshoexer@
Diffstat (limited to 'sbin/isakmpd/isakmpd.c')
-rw-r--r-- | sbin/isakmpd/isakmpd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sbin/isakmpd/isakmpd.c b/sbin/isakmpd/isakmpd.c index 2715b53fae4..eef80cd7e93 100644 --- a/sbin/isakmpd/isakmpd.c +++ b/sbin/isakmpd/isakmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isakmpd.c,v 1.89 2005/06/25 23:20:43 hshoexer Exp $ */ +/* $OpenBSD: isakmpd.c,v 1.90 2005/12/20 22:03:53 moritz Exp $ */ /* $EOM: isakmpd.c,v 1.54 2000/10/05 09:28:22 niklas Exp $ */ /* @@ -99,7 +99,7 @@ void daemon_shutdown_now(int); void set_slave_signals(void); /* The default path of the PID file. */ -static char *pid_file = "/var/run/isakmpd.pid"; +char *pid_file = "/var/run/isakmpd.pid"; /* The path of the IKE packet capture log file. */ static char *pcap_file = 0; @@ -330,9 +330,6 @@ daemon_shutdown(void) */ log_packet_stop(); - /* Remove FIFO and pid files. */ - unlink(ui_fifo); - unlink(pid_file); log_print("isakmpd: exit"); exit(0); } @@ -352,10 +349,9 @@ write_pid_file(void) { FILE *fp; - /* Ignore errors. This fails with privsep. */ unlink(pid_file); - fp = monitor_fopen(pid_file, "w"); + fp = fopen(pid_file, "w"); if (fp != NULL) { if (fprintf(fp, "%ld\n", (long) getpid()) < 0) log_error("write_pid_file: failed to write PID to " @@ -402,6 +398,8 @@ main(int argc, char *argv[]) /* Set timezone before priv'separation */ tzset(); + write_pid_file(); + if (monitor_init(debug)) { /* The parent, with privileges enters infinite monitor loop. */ monitor_loop(debug); @@ -411,8 +409,6 @@ main(int argc, char *argv[]) init(); - write_pid_file(); - /* If we wanted IKE packet capture to file, initialize it now. */ if (pcap_file != 0) log_packet_init(pcap_file); |