Merge "Fix race condition between restart and stop/reset."

This commit is contained in:
Tao Wu 2017-10-27 21:32:51 +00:00 committed by Gerrit Code Review
commit ee14225e0d
1 changed files with 7 additions and 0 deletions

View File

@ -960,6 +960,13 @@ void Service::StopOrReset(int how) {
} 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);