summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjp abgrall <jpa@google.com>2013-05-28 21:18:59 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-05-28 21:18:59 +0000
commit74bd799ec20d2420459fa382533b1cc39ca9a54c (patch)
tree9556991bf6e5e2a0dfad669ded0c6b0c3238746a
parent135e4dbd65d49730fbd6f830de7b303e01d20d5f (diff)
parent885f888c55587e9366542b5155a06c321cde175a (diff)
downloadframeworks_native-74bd799ec20d2420459fa382533b1cc39ca9a54c.zip
frameworks_native-74bd799ec20d2420459fa382533b1cc39ca9a54c.tar.gz
frameworks_native-74bd799ec20d2420459fa382533b1cc39ca9a54c.tar.bz2
Merge "Exit dumpstate on SIGPIPE to avoid cascading child crashes"
-rw-r--r--cmds/dumpstate/dumpstate.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 55a36c2..dbe9832 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -314,7 +314,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;
@@ -334,7 +340,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);