Fix a bug where calling MD5File(3) with a zero-length file generated an

error, due to an uninitialized variable.

Reviewed by:	phk, archie
This commit is contained in:
Bruce A. Mah 2002-09-06 19:51:58 +00:00
parent facfd6e8ed
commit 2ca720053b

View File

@ -66,6 +66,7 @@ MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len)
len = stbuf.st_size - ofs; len = stbuf.st_size - ofs;
if (lseek(f, ofs, SEEK_SET) < 0) return 0; if (lseek(f, ofs, SEEK_SET) < 0) return 0;
n = len; n = len;
i = 0;
while (n > 0) { while (n > 0) {
if (n > sizeof(buffer)) if (n > sizeof(buffer))
i = read(f, buffer, sizeof(buffer)); i = read(f, buffer, sizeof(buffer));