diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2001-07-04 05:17:40 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2001-07-04 05:17:40 +0000 |
commit | 4983d5ebd50800edd3c7caa08a37a5206221441d (patch) | |
tree | ec169cbc9c3bf6045c974985d202375911d7c67a /serverloop.c | |
parent | 173e646f7e04e559feb8815c27f2ffb13581d91e (diff) |
- markus@cvs.openbsd.org 2001/07/02 13:59:15
[serverloop.c session.c session.h]
wait until !session_have_children(); bugreport from
Lutz.Jaenicke@aet.TU-Cottbus.DE
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/serverloop.c b/serverloop.c index ecc7763a4..773292a94 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.72 2001/06/27 02:12:52 markus Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.73 2001/07/02 13:59:14 markus Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -703,11 +703,25 @@ server_loop2(Authctxt *authctxt) | |||
703 | if (writeset) | 703 | if (writeset) |
704 | xfree(writeset); | 704 | xfree(writeset); |
705 | 705 | ||
706 | channel_free_all(); | ||
707 | |||
708 | signal(SIGCHLD, SIG_DFL); | 706 | signal(SIGCHLD, SIG_DFL); |
707 | |||
709 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0) | 708 | while ((pid = waitpid(-1, &status, WNOHANG)) > 0) |
710 | session_close_by_pid(pid, status); | 709 | session_close_by_pid(pid, status); |
710 | /* | ||
711 | * there is a race between channel_free_all() killing children and | ||
712 | * children dying before kill() | ||
713 | */ | ||
714 | channel_free_all(); | ||
715 | |||
716 | while (session_have_children()) { | ||
717 | pid = waitpid(-1, &status, 0); | ||
718 | if (pid > 0) | ||
719 | session_close_by_pid(pid, status); | ||
720 | else { | ||
721 | error("waitpid returned %d: %s", pid, strerror(errno)); | ||
722 | break; | ||
723 | } | ||
724 | } | ||
711 | } | 725 | } |
712 | 726 | ||
713 | static void | 727 | static void |