]> granicus.if.org Git - strace/commitdiff
Move call_summary() from cleanup() to terminate()
authorEugene Syromyatnikov <evgsyr@gmail.com>
Tue, 19 Feb 2019 02:57:34 +0000 (03:57 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 19 Feb 2019 19:14:31 +0000 (19:14 +0000)
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

index b71ad05c12ea877f61a23fbc89da6dd9dd3ccadc..195d2c1bdf59bbaa33dba8f7f7ad0ad1ef0c39e0 100644 (file)
--- 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);