summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-05-28 02:43:06 +0100
committerPádraig Brady <P@draigBrady.com>2012-05-28 02:50:11 +0100
commit2ab72e3a4364a9dea2a086aa6adfdd02fca53b3d (patch)
tree63c2344e7e932ef8900e32dc9e9ee2112fa4301e /src
parent785234bc173a87ca26ad62ff2a64197039f0c459 (diff)
downloadcoreutils-2ab72e3a4364a9dea2a086aa6adfdd02fca53b3d.tar.xz
cksum: line-buffer the printed checksums
This utility was inadvertently omitted from commit v8.0-34-g710fe41 * src/cksum.c (main): Set stdout to line buffered mode, to ensure parallel running instances don't intersperse their output. * NEWS: Mention the fix. * THANKS.in: Add Anoop. Reported by Anoop Sharma.
Diffstat (limited to 'src')
-rw-r--r--src/cksum.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cksum.c b/src/cksum.c
index d3ce0f8e9..332f41d0d 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -290,6 +290,10 @@ main (int argc, char **argv)
atexit (close_stdout);
+ /* Line buffer stdout to ensure lines are written atomically and immediately
+ so that processes running in parallel do not intersperse their output. */
+ setvbuf (stdout, NULL, _IOLBF, 0);
+
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, Version,
usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "", NULL, NULL) != -1)