commit | ee14225e0d67e76c166ee91a1cddc237c735d738 | [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 | 7de02203cc164bcf52a26c006f8bd7e3a0002184 [diff] | |
parent | 84b856d90167d567238af95fceade30a0dc93d58 [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);