From: Eugene Syromyatnikov Date: Tue, 19 Feb 2019 02:57:34 +0000 (+0100) Subject: Move call_summary() from cleanup() to terminate() X-Git-Tag: v5.0~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84d57f25df323dc1c44a1ae86ecf06a194913560;p=strace 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. --- 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);