mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-03-24 22:04:36 +02:00
cksum would perform an extra read after encountering EOF
(cksum): Exit the loop upon EOF, too. Patch by Michael Bacarella.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user