projects
/
platform
/
upstream
/
coreutils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8770c00
)
(cksum): Avoid setmode; use POSIX-specified routines instead.
author
Paul Eggert
<eggert@cs.ucla.edu>
Mon, 11 Jul 2005 18:21:54 +0000
(18:21 +0000)
committer
Paul Eggert
<eggert@cs.ucla.edu>
Mon, 11 Jul 2005 18:21:54 +0000
(18:21 +0000)
src/cksum.c
patch
|
blob
|
history
diff --git
a/src/cksum.c
b/src/cksum.c
index
0499379
..
0dce68c
100644
(file)
--- a/
src/cksum.c
+++ b/
src/cksum.c
@@
-199,10
+199,12
@@
cksum (const char *file, bool print_name)
{
fp = stdin;
have_read_stdin = true;
+ if (O_BINARY && ! isatty (STDIN_FILENO))
+ freopen (NULL, "rb", stdin);
}
else
{
- fp = fopen (file,
"r"
);
+ fp = fopen (file,
(O_BINARY ? "rb" : "r")
);
if (fp == NULL)
{
error (0, errno, "%s", file);
@@
-210,9
+212,6
@@
cksum (const char *file, bool 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;