Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84b856d9 authored by Tao Wu's avatar Tao Wu
Browse files

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
parent 41a9b3c8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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);