diff options
| author | 2017-02-21 13:43:23 -0800 | |
|---|---|---|
| committer | 2017-02-21 13:50:12 -0800 | |
| commit | c6a900bee1553e491c4968d176f7fc799344b09f (patch) | |
| tree | 9d88de90bc2c448d07e11b50de8800a3d1d331ec /tools/makeparallel/makeparallel.cpp | |
| parent | 0aef0b59af84041080db7944537f2334e41491f0 (diff) | |
Prevent duplicate signals from makeparallel
As part of the soong_ui effort, we noticed that we'd sometimes see
multiple SIGINTs from a single ctrl-c from a user. ctrl-c sends a SIGINT
to the entire process group, so make, makeparallel, soong_ui, and all of
its children would get a signal. Since makeparallel was passing it along
to it's child, soong_ui would get two signals.
So instead, follow what Make does and only pass along SIGTERM. Assume
that all other signals went to the entire process group.
Bug: 35214134
Test: Send SIGINT to process group, check in makeparallel's child for
more than one signal received.
Change-Id: I5b2a77ad0fcebbaa5087439948e71bf3b541061a
Diffstat (limited to 'tools/makeparallel/makeparallel.cpp')
| -rw-r--r-- | tools/makeparallel/makeparallel.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/makeparallel/makeparallel.cpp b/tools/makeparallel/makeparallel.cpp index 0e1e45c153..a99b2867ae 100644 --- a/tools/makeparallel/makeparallel.cpp +++ b/tools/makeparallel/makeparallel.cpp @@ -357,8 +357,8 @@ int main(int argc, char* argv[]) { static pid_t pid; - // Set up signal handlers to forward SIGHUP, SIGINT, SIGQUIT, SIGTERM, and - // SIGALRM to child + // Set up signal handlers to forward SIGTERM to child + // Assume that all other signals are sent to the entire process group struct sigaction action = {}; action.sa_flags = SA_SIGINFO | SA_RESTART, action.sa_sigaction = [](int signal, siginfo_t*, void*) { @@ -368,11 +368,7 @@ int main(int argc, char* argv[]) { }; int ret = 0; - if (!ret) ret = sigaction(SIGHUP, &action, NULL); - if (!ret) ret = sigaction(SIGINT, &action, NULL); - if (!ret) ret = sigaction(SIGQUIT, &action, NULL); if (!ret) ret = sigaction(SIGTERM, &action, NULL); - if (!ret) ret = sigaction(SIGALRM, &action, NULL); if (ret < 0) { error(errno, errno, "sigaction failed"); } |