Fix race condition between restart and stop/reset.
If there is a restart follow a stop/reset immediately or vice versa, clear previous flag bits. Test: manual - trigger restart after stop immediately to check if service get started. Change-Id: I4503177d7cb5ed054dbcf50cd8e09728415404d4
This commit is contained in:
parent
41a9b3c81d
commit
84b856d901
|
@ -940,6 +940,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);
|
||||
|
|
Loading…
Reference in New Issue