diff options
author | Jim Meyering <jim@meyering.net> | 2003-02-18 08:05:02 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-02-18 08:05:02 +0000 |
commit | d2c4a4e44daecf76329aed83adaf7e8c6dccb88e (patch) | |
tree | 0e860b741de7c50d6e9bff2b4962249dd7db4c5c /src/cksum.c | |
parent | b47c09ad6061645b8941ec1dd4328ebd5ee79bd3 (diff) | |
download | coreutils-d2c4a4e44daecf76329aed83adaf7e8c6dccb88e.tar.xz |
cksum would perform an extra read after encountering EOF
(cksum): Exit the loop upon EOF, too.
Patch by Michael Bacarella.
Diffstat (limited to 'src/cksum.c')
-rw-r--r-- | src/cksum.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cksum.c b/src/cksum.c index 9148e9446..0bbba3a3c 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -1,5 +1,5 @@ /* cksum -- calculate and print POSIX checksums and sizes of files - Copyright (C) 92, 1995-2002 Free Software Foundation, Inc. + Copyright (C) 92, 1995-2003 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 @@ -235,6 +235,8 @@ cksum (const char *file, int print_name) length += bytes_read; while (bytes_read--) crc = (crc << 8) ^ crctab[((crc >> 24) ^ *cp++) & 0xFF]; + if (feof (fp)) + break; } if (ferror (fp)) |