diff options
author | 2013-05-28 15:52:27 -0700 | |
---|---|---|
committer | 2013-05-28 15:52:27 -0700 | |
commit | c40f4e64f267c78ff04862456092002d318a8adc (patch) | |
tree | 4305b78e8995112afdaf5eb32c62d45171c30490 | |
parent | ad8ce823966f985bf8fb0f5c5fe49b27214ed15e (diff) | |
parent | 4b2b0a7494c872b7d545a9abe2d08ca0d0325073 (diff) |
am 4b2b0a74: am 74bd799e: Merge "Exit dumpstate on SIGPIPE to avoid cascading child crashes"
* commit '4b2b0a7494c872b7d545a9abe2d08ca0d0325073':
Exit dumpstate on SIGPIPE to avoid cascading child crashes
-rw-r--r-- | cmds/dumpstate/dumpstate.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c index 9a332a96d8..89bea917d7 100644 --- a/cmds/dumpstate/dumpstate.c +++ b/cmds/dumpstate/dumpstate.c @@ -315,7 +315,13 @@ static void usage() { ); } +static void sigpipe_handler(int n) { + (void)n; + exit(EXIT_FAILURE); +} + int main(int argc, char *argv[]) { + struct sigaction sigact; int do_add_date = 0; int do_compress = 0; int do_vibrate = 1; @@ -336,7 +342,9 @@ int main(int argc, char *argv[]) { } ALOGI("begin\n"); - signal(SIGPIPE, SIG_IGN); + memset(&sigact, 0, sizeof(sigact)); + sigact.sa_handler = sigpipe_handler; + sigaction(SIGPIPE, &sigact, NULL); /* set as high priority, and protect from OOM killer */ setpriority(PRIO_PROCESS, 0, -20); |