Avoid infinite loop if read() fails consistently.

PR:		misc/7926
Submitted by:	Sergey Potapov <sp@alkor.ru>
This commit is contained in:
des 1998-09-16 15:53:25 +00:00
parent fb8165a347
commit 76ada56e70

View File

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