]> git.saurik.com Git - apple/ipsec.git/blobdiff - ipsec-tools/racoon/schedule.c
ipsec-93.13.tar.gz
[apple/ipsec.git] / ipsec-tools / racoon / schedule.c
index 705f4ce6437ea06a969ce7a5bea09a195bcf00a0..fe82c30ddea260b4076125c8a1698e02f7489dd2 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: schedule.c,v 1.4 2006/09/09 16:22:10 manu Exp $        */
+
 /*     $KAME: schedule.c,v 1.19 2001/11/05 10:53:19 sakane Exp $       */
 
 /*
 #include "var.h"
 #include "gcmalloc.h"
 
+#if !defined(__LP64__)
+// year 2038 problem and fix for 32-bit only
 #define FIXY2038PROBLEM
+#endif
 
 #ifndef TAILQ_FOREACH
 #define TAILQ_FOREACH(elm, head, field) \
         for (elm = TAILQ_FIRST(head); elm; elm = TAILQ_NEXT(elm, field))
 #endif
 
+extern int             terminated;
 static struct timeval timeout;
 
 #ifdef FIXY2038PROBLEM
@@ -83,7 +89,7 @@ schedular()
 
        now = current_time();
 
-        for (p = TAILQ_FIRST(&sctree); p; p = next) {
+       for (p = TAILQ_FIRST(&sctree); p; p = next) {
                /* if the entry has been dead, remove it */
                if (p->dead)
                        goto next_schedule;
@@ -96,7 +102,7 @@ schedular()
 
                /* mark it with dead. and call the function. */
                p->dead = 1;
-               if (p->func != NULL)
+               if (p->func != NULL && !terminated)
                        (p->func)(p->param);
 
           next_schedule:
@@ -308,7 +314,7 @@ getstdin()
                struct scheddump *scbuf, *p;
                int len;
                sched_dump((caddr_t *)&scbuf, &len);
-               if (buf == NULL)
+               if (scbuf == NULL)
                        return;
                for (p = scbuf; len; p++) {
                        printf("xtime=%ld\n", p->xtime);