From: Jesper Dahl Nyerup Date: Tue, 18 Feb 2014 19:48:45 +0000 (+0100) Subject: script: Also flush writes to timing file. X-Git-Tag: v2.25-rc1~570 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d0ce5e84fcf545caef142b0e4e25d001e1e8373;p=thirdparty%2Futil-linux.git script: Also flush writes to timing file. 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 --- diff --git a/term-utils/script.c b/term-utils/script.c index a4c2e0cec4..d6e04d66a1 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -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();