]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: Also flush writes to timing file.
authorJesper Dahl Nyerup <nyerup@one.com>
Tue, 18 Feb 2014 19:48:45 +0000 (20:48 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 21 Feb 2014 12:16:20 +0000 (13:16 +0100)
If both -f and -t are given, flush the timing fd on each write, similar
to the behavior on the script fd. This allows playback of still-running
sessions, and reduces the risk of ending up with empty timing files when
script(1) exits abnormally.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
term-utils/script.c

index a4c2e0cec4c5ed6b0d25a1165999651a9f08cd26..d6e04d66a1a9481ce7224b1477fa75b09ab56411 100644 (file)
@@ -440,8 +440,11 @@ dooutput(FILE *timingfd) {
                        warn (_("cannot write script file"));
                        fail();
                }
-               if (fflg)
+               if (fflg) {
                        fflush(fscript);
+                       if (tflg)
+                               fflush(timingfd);
+               }
                if (write_all(STDOUT_FILENO, obuf, cc)) {
                        warn (_("write failed"));
                        fail();