diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-01-29 16:43:51 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-01-29 16:43:51 +0100 |
commit | a3559250d48ccc3ef755183ebb3246cbbb442c0d (patch) | |
tree | 8266a7eb988565147cc31300d9a40f8f7241fae7 | |
parent | 31fa8a22b17b2f898513b68e04269597147d2478 (diff) | |
download | strace-a3559250d48ccc3ef755183ebb3246cbbb442c0d.tar.gz |
On Ctrl-C induced detach, send SIGINT to child tracee, not SIGTERM.
* strace.c (interrupt): Remember signal number.
(cleanup): If we exiting due to signal, send that signal to child tracee.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | strace.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -149,9 +149,9 @@ static sigset_t empty_set, blocked_set; #ifdef HAVE_SIG_ATOMIC_T static volatile sig_atomic_t interrupted; -#else /* !HAVE_SIG_ATOMIC_T */ +#else static volatile int interrupted; -#endif /* !HAVE_SIG_ATOMIC_T */ +#endif #ifdef USE_PROCFS @@ -1939,6 +1939,7 @@ cleanup(void) { int i; struct tcb *tcp; + int fatal_sig = interrupted ? interrupted : SIGTERM; for (i = 0; i < tcbtabsize; i++) { tcp = tcbtab[i]; @@ -1956,7 +1957,7 @@ cleanup(void) detach(tcp); else { kill(tcp->pid, SIGCONT); - kill(tcp->pid, SIGTERM); + kill(tcp->pid, fatal_sig); } } if (cflag) @@ -1966,7 +1967,7 @@ cleanup(void) static void interrupt(int sig) { - interrupted = 1; + interrupted = sig; } #ifndef HAVE_STRERROR |