summaryrefslogtreecommitdiffstats
path: root/cmds/dumpstate/utils.c
diff options
context:
space:
mode:
authorAndres Morales <anmorales@google.com>2014-08-21 12:38:22 -0700
committerAndres Morales <anmorales@google.com>2014-08-22 12:10:44 -0700
commit2e671bbdb741c2926b6df7b240fdc31c7361f330 (patch)
tree9ab264a786cbb21c93cec436b11f6cc40da0fda8 /cmds/dumpstate/utils.c
parent61a4eecbe615bc94944161c4cf4aa590dfca1b2e (diff)
downloadframeworks_native-2e671bbdb741c2926b6df7b240fdc31c7361f330.zip
frameworks_native-2e671bbdb741c2926b6df7b240fdc31c7361f330.tar.gz
frameworks_native-2e671bbdb741c2926b6df7b240fdc31c7361f330.tar.bz2
Fix deadlock when killing adb bugreport
Leave default signal handler (terminate) for parent process, add SIG_IGN as signal handler for children and let them go down when the parent gets SIGPIPE. Bug: 17109154 Change-Id: Id33db3e97a32f289eb2a9a1a0ca8acbe3dcd285d
Diffstat (limited to 'cmds/dumpstate/utils.c')
-rw-r--r--cmds/dumpstate/utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index a6d9ef6..85c353e 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -313,6 +313,12 @@ int run_command(const char *title, int timeout_seconds, const char *command, ...
/* make sure the child dies when dumpstate dies */
prctl(PR_SET_PDEATHSIG, SIGKILL);
+ /* just ignore SIGPIPE, will go down with parent's */
+ struct sigaction sigact;
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &sigact, NULL);
+
va_list ap;
va_start(ap, command);
if (title) printf("------ %s (%s", title, command);