Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 980cbef0 authored by Tom Cherry's avatar Tom Cherry Committed by Gerrit Code Review
Browse files

Merge "init: Check onrestart commands"

parents e269a721 6737a6bf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ int main(int argc, char** argv) {
        LOG(ERROR) << "Failed to open init rc script '" << *argv << "'";
        return EXIT_FAILURE;
    }
    size_t failures = parser.parse_error_count() + am.CheckAllCommands();
    size_t failures = parser.parse_error_count() + am.CheckAllCommands() + sl.CheckAllCommands();
    if (failures > 0) {
        LOG(ERROR) << "Failed to parse init script '" << *argv << "' with " << failures
                   << " errors";
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ class Service {
    void AddReapCallback(std::function<void(const siginfo_t& siginfo)> callback) {
        reap_callbacks_.emplace_back(std::move(callback));
    }
    size_t CheckAllCommands() const { return onrestart_.CheckAllCommands(); }

    static bool is_exec_service_running() { return is_exec_service_running_; }

+8 −0
Original line number Diff line number Diff line
@@ -28,6 +28,14 @@ ServiceList& ServiceList::GetInstance() {
    return instance;
}

size_t ServiceList::CheckAllCommands() {
    size_t failures = 0;
    for (const auto& service : services_) {
        failures += service->CheckAllCommands();
    }
    return failures;
}

void ServiceList::AddService(std::unique_ptr<Service> service) {
    services_.emplace_back(std::move(service));
}
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ class ServiceList {

    // Exposed for testing
    ServiceList();
    size_t CheckAllCommands();

    void AddService(std::unique_ptr<Service> service);
    void RemoveService(const Service& svc);