commit | 59f92f2546e2d29b08846ada57383b89f6a82d21 | [log] [tgz] |
---|---|---|
author | Tao Wu <lepton@google.com> | Fri Oct 27 21:32:51 2017 +0000 |
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | Fri Oct 27 21:32:51 2017 +0000 |
tree | 2e8a75b442704e3014d7a78d4ba1c1eeec49fdea | |
parent | 1de599208f7b5fc69caf484389c5e7bce597a2d5 [diff] | |
parent | 0302f0aa24d288ceee19e1296db932d1aa98b58b [diff] |
Merge "Fix race condition between restart and stop/reset."
diff --git a/init/service.cpp b/init/service.cpp index 45e3f06..12acfc6 100644 --- a/init/service.cpp +++ b/init/service.cpp
@@ -960,6 +960,13 @@ } else { flags_ |= how; } + // Make sure it's in right status when a restart immediately follow a + // stop/reset or vice versa. + if (how == SVC_RESTART) { + flags_ &= (~(SVC_DISABLED | SVC_RESET)); + } else { + flags_ &= (~SVC_RESTART); + } if (pid_) { KillProcessGroup(SIGKILL);