(cksum) [O_BINARY]: Read redirected stdin in binary mode.
authorJim Meyering <jim@meyering.net>
Fri, 1 Jan 1999 22:22:02 +0000 (22:22 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 1 Jan 1999 22:22:02 +0000 (22:22 +0000)
src/cksum.c

index a8030e7..81d745d 100644 (file)
@@ -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;