1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-20 02:36:16 +02:00

(cksum): Avoid setmode; use POSIX-specified routines instead.

This commit is contained in:
Paul Eggert
2005-07-11 18:21:54 +00:00
parent 8770c00ef4
commit 9824112cfa

View File

@@ -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;