]> granicus.if.org Git - strace/commitdiff
When we write log, flush output buffers in a few more cases
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 18 Jan 2012 15:20:56 +0000 (16:20 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Wed, 18 Jan 2012 15:20:56 +0000 (16:20 +0100)
I observed a case when signal delivery message was buffered
by stdio until it was flushed along with the next syscall
entry message.

* strace.c (trace): Flush output buffers in a few more cases.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
strace.c

index 910a11c96ef024ee14bfba6c5e9de3235e02487e..ed7d641a4ce9cf8583a541d212084edbbfaea08d 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -2462,6 +2462,7 @@ trace()
 #endif
                                printtrailer();
                        }
+                       fflush(tcp->outf);
                        droptcb(tcp);
                        continue;
                }
@@ -2479,6 +2480,7 @@ trace()
                                tprintf("+++ exited with %d +++", WEXITSTATUS(status));
                                printtrailer();
                        }
+                       fflush(tcp->outf);
                        droptcb(tcp);
                        continue;
                }
@@ -2580,6 +2582,7 @@ trace()
                                                signame(sig)
                                                PC_FORMAT_ARG);
                                printtrailer();
+                               fflush(tcp->outf);
                        }
                        goto restart_tracee;
                }
@@ -2606,6 +2609,7 @@ trace()
                                        tcp_last->flags |= TCB_REPRINT;
                                        tprints(" <unfinished ...>");
                                        printtrailer();
+                                       fflush(tcp->outf);
                                }
                                /* We assume that ptrace error was caused by process death.
                                 * We used to detach(tcp) here, but since we no longer