diff options
author | des <des@FreeBSD.org> | 1998-09-16 15:53:25 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 1998-09-16 15:53:25 +0000 |
commit | 76ada56e70e50478b977a38fbac7042c54fdcfca (patch) | |
tree | dee1cba6de8dc4c70f43c35390feda1e11de741e /usr.bin/cksum | |
parent | fb8165a3471759a3bd9fbeba6bc8b330adae6fa5 (diff) | |
download | FreeBSD-src-76ada56e70e50478b977a38fbac7042c54fdcfca.zip FreeBSD-src-76ada56e70e50478b977a38fbac7042c54fdcfca.tar.gz |
Avoid infinite loop if read() fails consistently.
PR: misc/7926
Submitted by: Sergey Potapov <sp@alkor.ru>
Diffstat (limited to 'usr.bin/cksum')
-rw-r--r-- | usr.bin/cksum/crc32.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c index 1cc29a2..6938ba6 100644 --- a/usr.bin/cksum/crc32.c +++ b/usr.bin/cksum/crc32.c @@ -103,7 +103,7 @@ crc32(fd, cval, clen) len = 0 ; crc32_total = ~crc32_total ; - while ((nr = read(fd, buf, sizeof(buf)))) + while ((nr = read(fd, buf, sizeof(buf))) > 0) for (len += nr, p = buf; nr--; ++p) { CRC(crc, *p) ; CRC(crc32_total, *p) ; |