* 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>
#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
{
int i;
struct tcb *tcp;
+ int fatal_sig = interrupted ? interrupted : SIGTERM;
for (i = 0; i < tcbtabsize; i++) {
tcp = tcbtab[i];
detach(tcp);
else {
kill(tcp->pid, SIGCONT);
- kill(tcp->pid, SIGTERM);
+ kill(tcp->pid, fatal_sig);
}
}
if (cflag)
static void
interrupt(int sig)
{
- interrupted = 1;
+ interrupted = sig;
}
#ifndef HAVE_STRERROR