From f01becb58cfe6f0f36e5e55c58f22aab270fbe06 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Tue, 14 Jun 2016 14:14:53 +0100 Subject: [PATCH] Use _exit instead of exit after fork --- src/service.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/service.cc b/src/service.cc index 7dd8cb1..d367b2b 100644 --- a/src/service.cc +++ b/src/service.cc @@ -710,7 +710,7 @@ bool ServiceRecord::start_ps_process(const std::vector &cmd, bool failure_out: int exec_status = errno; write(pipefd[1], &exec_status, sizeof(int)); - exit(0); + _exit(0); } else { // Parent process @@ -820,6 +820,10 @@ bool ServiceRecord::stopDependents() noexcept bool all_deps_stopped = true; for (sr_iter i = dependents.begin(); i != dependents.end(); ++i) { if (! (*i)->is_stopped()) { + // Note we check *first* since if the dependent service is not stopped, + // 1. We will issue a stop to it shortly and + // 2. It will notify us when stopped, at which point the stopCheckDependents() + // check is run anyway. all_deps_stopped = false; } if (force_stop) { -- 2.25.1