From d6b65fb307fa38ad44fe4da38497d4f78fcdad7a Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 22 Aug 2023 09:59:26 +0900 Subject: [PATCH] init: reset errno in do_start do_start() ignores ENOENT intentionally to avoid logspam. It's implemented in ErrorIgnoreEnoent. However, without resetting errno, ErrorIgnoreEnoent will ignore unrelated errors from Service::Start() due to the sticking errono set from other commands. Bug: 296821716 Test: launch_cvd Change-Id: I71d3113bdb69bdca82e2ff4f3a793301749f6c08 --- init/builtins.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/init/builtins.cpp b/init/builtins.cpp index 7715424f5..a70e86683 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -746,6 +746,7 @@ static Result do_setrlimit(const BuiltinArguments& args) { static Result do_start(const BuiltinArguments& args) { Service* svc = ServiceList::GetInstance().FindService(args[1]); if (!svc) return Error() << "service " << args[1] << " not found"; + errno = 0; if (auto result = svc->Start(); !result.ok()) { return ErrorIgnoreEnoent() << "Could not start service: " << result.error(); }