From: Davin McCall Date: Fri, 26 May 2017 17:58:54 +0000 (+0100) Subject: Avoid releasing console twice on failure to read pid file. X-Git-Tag: v0.06~118 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=670499b6f0b591316867c575bd80129aebbbe69f;p=oweals%2Fdinit.git Avoid releasing console twice on failure to read pid file. --- diff --git a/src/service.cc b/src/service.cc index 25b6294..c5a60f3 100644 --- a/src/service.cc +++ b/src/service.cc @@ -695,18 +695,18 @@ bool ServiceRecord::read_pid_file() noexcept void ServiceRecord::started() noexcept { - if (onstart_flags.runs_on_console && (service_type == ServiceType::SCRIPTED || service_type == ServiceType::BGPROCESS)) { - tcsetpgrp(0, getpgrp()); - releaseConsole(); - } - if (service_type == ServiceType::BGPROCESS && pid_file.length() != 0) { if (! read_pid_file()) { failed_to_start(); return; } } - + + if (onstart_flags.runs_on_console && (service_type == ServiceType::SCRIPTED || service_type == ServiceType::BGPROCESS)) { + tcsetpgrp(0, getpgrp()); + releaseConsole(); + } + logServiceStarted(service_name); service_state = ServiceState::STARTED; notifyListeners(ServiceEvent::STARTED);