From af9a06466ce725bf954af3fdd2db917747ea629b Mon Sep 17 00:00:00 2001 From: Jonas Johansson Date: Fri, 23 Mar 2018 15:39:00 +0100 Subject: [PATCH] inetd: stop inetd spawned child processes when stopping inetd service Signed-off-by: Jonas Johansson --- src/inetd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/inetd.c b/src/inetd.c index f12da3e6..043fbe47 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -351,9 +351,20 @@ void inetd_stop(inetd_t *inetd) * and halt the watcher, so don't close the socket! */ if (!svc_is_busy(inetd->svc)) { + svc_t *svc, *iter = NULL; + _d("Shutting down inet socket %d ...", inetd->watcher.fd); close(inetd->watcher.fd); inetd->watcher.fd = -1; + + svc = svc_job_iterator(&iter, 1, inetd->svc->job); + while (svc) { + if (!svc_is_inetd(svc)) { + svc_stop(svc); + service_step(svc); + } + svc = svc_job_iterator(&iter, 0, inetd->svc->job); + } } } }