Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/kame/racoon Remove the pid file upon exit.



details:   https://anonhg.NetBSD.org/src/rev/fed2a160985d
branches:  trunk
changeset: 503315:fed2a160985d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Feb 04 20:15:52 2001 +0000

description:
Remove the pid file upon exit.

diffstat:

 crypto/dist/kame/racoon/main.c |  13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diffs (37 lines):

diff -r 486f012a198e -r fed2a160985d crypto/dist/kame/racoon/main.c
--- a/crypto/dist/kame/racoon/main.c    Sun Feb 04 20:09:40 2001 +0000
+++ b/crypto/dist/kame/racoon/main.c    Sun Feb 04 20:15:52 2001 +0000
@@ -73,6 +73,7 @@
 static void restore_params __P((void));
 static void save_params __P((void));
 static void saverestore_params __P((int));
+static void cleanup_pidfile __P((void));
 
 void
 Usage()
@@ -176,6 +177,10 @@
                        plog(LLV_ERROR, LOCATION, NULL,
                                "cannot open %s", pid_file);
                }
+               if (atexit(cleanup_pidfile) < 0) {
+                       plog(LLV_ERROR, LOCATION, NULL,
+                               "cannot register pidfile cleanup");
+               }
        }
 
        session();
@@ -184,6 +189,14 @@
 }
 
 static void
+cleanup_pidfile()
+{
+       char *pid_file = _PATH_VARRUN "racoon.pid";
+
+       (void) unlink(pid_file);
+}
+
+static void
 parse(ac, av)
        int ac;
        char **av;



Home | Main Index | Thread Index | Old Index