summaryrefslogtreecommitdiff
path: root/src/cksum.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-01-01 22:22:02 +0000
committerJim Meyering <jim@meyering.net>1999-01-01 22:22:02 +0000
commit4394c38352f0b007e45ed63678b0d28b1fa07316 (patch)
treede300a5db1439cdeb84e0637dec21ef39ecb1cb8 /src/cksum.c
parent7914fb4069f2c56e29eecd98b75fa9c278d90022 (diff)
downloadcoreutils-4394c38352f0b007e45ed63678b0d28b1fa07316.tar.xz
(cksum) [O_BINARY]: Read redirected stdin in binary mode.
Diffstat (limited to 'src/cksum.c')
-rw-r--r--src/cksum.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cksum.c b/src/cksum.c
index a8030e7df..81d745d80 100644
--- a/src/cksum.c
+++ b/src/cksum.c
@@ -1,5 +1,5 @@
/* cksum -- calculate and print POSIX.2 checksums and sizes of files
- Copyright (C) 92, 95, 96, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 92, 1995-1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -217,6 +217,9 @@ cksum (char *file, int print_name)
}
}
+ /* Read input in BINARY mode, unless it is a console device. */
+ SET_BINARY (fileno (fp));
+
while ((bytes_read = fread (buf, 1, BUFLEN, fp)) > 0)
{
unsigned char *cp = buf;