From: Davin McCall Date: Tue, 14 Jun 2016 13:14:53 +0000 (+0100) Subject: Use _exit instead of exit after fork X-Git-Tag: v0.03~23 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f01becb58cfe6f0f36e5e55c58f22aab270fbe06;p=oweals%2Fdinit.git Use _exit instead of exit after fork --- 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) {