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.24.2~75 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f5ececbcce7f8bbc869841c4cb7a2093589f58f;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 Signed-off-by: Karel Zak --- diff --git a/term-utils/script.c b/term-utils/script.c index 959bcc058e..3180ddfd54 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -399,8 +399,11 @@ dooutput(FILE *timingfd) { warn (_("cannot write script file")); fail(); } - if (fflg) + if (fflg) { fflush(fscript); + if (tflg) + fflush(timingfd); + } wrt = write(STDOUT_FILENO, obuf, cc); if (wrt < 0) { warn (_("write failed"));