diff --git a/init/service.cpp b/init/service.cpp index 0ddc48485..bdecc324f 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -416,7 +416,7 @@ bool Service::Start(const std::vector& dynamic_args) { } } - std::string pid_str = StringPrintf("%d", pid); + std::string pid_str = StringPrintf("%d", getpid()); for (const auto& file : writepid_files_) { if (!WriteStringToFile(pid_str, file)) { ERROR("couldn't write %s to %s: %s\n",