summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2005-03-26 11:04:28 +0000
committerhenning <henning@openbsd.org>2005-03-26 11:04:28 +0000
commitd67317b71f25f61c85d37a053a566a985ae708af (patch)
treeb8bc15c7c7e5d8060df09ad1c8e4f0f906d88cfa
parentacct, ktrace, and ptrace are only available if the kernel option is there. (diff)
downloadwireguard-openbsd-d67317b71f25f61c85d37a053a566a985ae708af.tar.xz
wireguard-openbsd-d67317b71f25f61c85d37a053a566a985ae708af.zip
fix a little race on SIGCHLD where we must delay the claenup until
we invalidated all child pids in case both were killed in a very short time, spotted by and diff from Michael Knudsen <e@molioner.dk>, claudio ok
-rw-r--r--usr.sbin/ospfd/ospfd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index 25cbbb6efd8..dc6ca68b070 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.11 2005/03/25 13:39:10 henning Exp $ */
+/* $OpenBSD: ospfd.c,v 1.12 2005/03/26 11:04:28 henning Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -77,6 +77,8 @@ main_sig_handler(int sig, short event, void *arg)
* signal handler rules don't apply, libevent decouples for us
*/
+ int die = 0;
+
switch (sig) {
case SIGTERM:
case SIGINT:
@@ -85,12 +87,14 @@ main_sig_handler(int sig, short event, void *arg)
case SIGCHLD:
if (check_child(ospfe_pid, "ospf engine")) {
ospfe_pid = 0;
- ospfd_shutdown();
+ die = 1;
}
if (check_child(rde_pid, "route decision engine")) {
rde_pid = 0;
- ospfd_shutdown();
+ die = 1;
}
+ if (die)
+ ospfd_shutdown();
break;
case SIGHUP:
/* reconfigure */