From: Davin McCall Date: Wed, 30 Dec 2015 00:24:22 +0000 (+0000) Subject: Fix bug in ServiceSet::loadService (only worked properly for already-loaded X-Git-Tag: v0.01~86 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=baf77bd1e6c01fa3c3bbf753765fc849d81e60e8;p=oweals%2Fdinit.git Fix bug in ServiceSet::loadService (only worked properly for already-loaded services) and add an accessor method for desired_state. --- diff --git a/service.h b/service.h index 0662757..5f533f5 100644 --- a/service.h +++ b/service.h @@ -291,10 +291,17 @@ class ServiceRecord // TODO write a destructor + // Get the current service state. ServiceState getState() noexcept { return service_state; } + + // Get the target (aka desired) state. + ServiceState getTargetState() noexcept + { + return desired_state; + } // Set logfile, should be done before service is started void setLogfile(string logfile) @@ -395,7 +402,7 @@ class ServiceSet { ServiceRecord *record = findService(name); if (record == nullptr) { - loadServiceRecord(name.c_str()); + record = loadServiceRecord(name.c_str()); } return record; }