From 84d57f25df323dc1c44a1ae86ecf06a194913560 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Tue, 19 Feb 2019 03:57:34 +0100 Subject: [PATCH] Move call_summary() from cleanup() to terminate() cleanup() has exactly two call sites, die() and terminate(), and the first one resets cflag in order to prevent call_summary() invocation. Move the call to terminate() in order to avoid bogus cflag reset. * strace.c (die): Remove cflag reset. (cleanup): Move call_summary() call ... (terminate): ... here. --- strace.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/strace.c b/strace.c index b71ad05c..195d2c1b 100644 --- a/strace.c +++ b/strace.c @@ -309,7 +309,6 @@ void ATTRIBUTE_NORETURN die(void) { if (strace_tracer_pid == getpid()) { - cflag = 0; cleanup(); exit(1); } @@ -1947,8 +1946,6 @@ cleanup(void) } detach(tcp); } - if (cflag) - call_summary(shared_log); } static void @@ -2646,6 +2643,8 @@ static void ATTRIBUTE_NORETURN terminate(void) { cleanup(); + if (cflag) + call_summary(shared_log); fflush(NULL); if (shared_log != stderr) fclose(shared_log); -- 2.50.1