From ba2ab4b4469180aaa2fad87b83b5b50541520538 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 22 Jan 2018 20:52:37 +0100 Subject: [PATCH] Follow-up to 2683049, only stop running, non-inet, services Signed-off-by: Joachim Nilsson --- src/service.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index dcd88cbe..0c155e0e 100644 --- a/src/service.c +++ b/src/service.c @@ -857,8 +857,14 @@ void service_unregister(svc_t *svc) if (!svc) return; - service_stop(svc); - service_step(svc); + /* + * Only call service_stop() if @svc is still running *and* it's + * not an inetd connection. This prevents infinite recursion if + * called from service_step(), or if it's an inet connection and + * it's already been stopped. + */ + if (svc->pid && !svc_is_inetd_conn(svc)) + service_stop(svc); if (svc_is_inetd(svc)) { if (svc_is_busy(svc->inetd.svc)) {