From 8daf1719efb2f37d6ef507c839a2e40af6aa2252 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Sat, 26 Mar 2005 11:04:29 +0000 Subject: 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 , claudio ok --- usr.sbin/ospfd/ospfd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'usr.sbin/ospfd') 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 @@ -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 */ -- cgit v1.2.3