mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 11:02:44 +00:00
Avoid infinite loop if read() fails consistently.
PR: misc/7926 Submitted by: Sergey Potapov <sp@alkor.ru>
This commit is contained in:
parent
83e2676ff1
commit
d26060f2e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39363
@ -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) ;
|
||||
|
Loading…
Reference in New Issue
Block a user