Merge "send SIGTERM only once"

This commit is contained in:
Treehugger Robot 2017-03-30 04:10:39 +00:00 committed by Gerrit Code Review
commit 9ead7c4a74

View file

@ -211,7 +211,13 @@ void Service::KillProcessGroup(int signal) {
LOG(INFO) << "Sending signal " << signal
<< " to service '" << name_
<< "' (pid " << pid_ << ") process group...";
if (killProcessGroup(uid_, pid_, signal) == -1) {
int r;
if (signal == SIGTERM) {
r = killProcessGroupOnce(uid_, pid_, signal);
} else {
r = killProcessGroup(uid_, pid_, signal);
}
if (r == -1) {
PLOG(ERROR) << "killProcessGroup(" << uid_ << ", " << pid_ << ", " << signal << ") failed";
}
if (kill(-pid_, signal) == -1) {