script: -f means "flush", not "fsync"
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 7 Aug 2017 00:21:34 +0000 (02:21 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 7 Aug 2017 00:21:34 +0000 (02:21 +0200)
function                                             old     new   delta
packed_usage                                       31765   31768      +3
script_main                                         1102    1082     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/script.c

index 62a2417624e4682e3bd96915c36f33963acb8bf6..89b439163b71a6aeb410dbaf30c799fe4caf1d8a 100644 (file)
@@ -27,7 +27,8 @@
 //usage:     "\n"
 //usage:     "\n       -a      Append output"
 //usage:     "\n       -c PROG Run PROG, not shell"
-//usage:     "\n       -f      Flush output after each write"
+/* Accepted but has no effect (we never buffer output) */
+/*//usage:     "\n     -f      Flush output after each write"*/
 //usage:     "\n       -q      Quiet"
 //usage:     "\n       -t[FILE] Send timing to stderr or FILE"
 
@@ -178,9 +179,10 @@ int script_main(int argc UNUSED_PARAM, char **argv)
                                        }
                                        full_write(STDOUT_FILENO, buf, count);
                                        full_write(outfd, buf, count);
-                                       if (opt & OPT_f) {
-                                               fsync(outfd);
-                                       }
+                                       // If we'd be using (buffered) FILE i/o, we'd need this:
+                                       //if (opt & OPT_f) {
+                                       //      fflush(outfd);
+                                       //}
                                }
                        }
                        if (pfd[1].revents) {