summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2003-12-20 18:50:41 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2003-12-20 18:50:41 +0000
commita8cf59620e780cdfde63837a267389e3e84948cc (patch)
tree3b4573478298dfa0363d721d4594f80d5001d289 /usr.sbin
parent14a96b44bbc9ff2303d0064ae9fff5188b1069f6 (diff)
parent: waitpid() for the child processes on exit
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/bgpd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index c8ae1c2e6a7..bd8f77b4911 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.4 2003/12/20 18:32:22 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.5 2003/12/20 18:50:40 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <err.h>
@@ -268,6 +269,10 @@ main(int argc, char *argv[])
if (rde_pid)
kill(rde_pid, SIGTERM);
+ do {
+ i = waitpid(-1, NULL, WNOHANG);
+ } while (i > 0 || (i == -1 && errno == EINTR));
+
logit(LOG_CRIT, "Terminating");
return (0);
}