diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/hash/helper.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/hash/helper.c b/lib/libc/hash/helper.c index a4a2255127c..27d053be3b2 100644 --- a/lib/libc/hash/helper.c +++ b/lib/libc/hash/helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: helper.c,v 1.8 2005/08/08 08:05:35 espie Exp $ */ +/* $OpenBSD: helper.c,v 1.9 2010/01/08 13:30:21 oga Exp $ */ /* * ---------------------------------------------------------------------------- @@ -62,8 +62,10 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len) } len = sb.st_size; } - if (off > 0 && lseek(fd, off, SEEK_SET) < 0) + if (off > 0 && lseek(fd, off, SEEK_SET) < 0) { + close(fd); return (NULL); + } while ((nr = read(fd, buffer, MIN(sizeof(buffer), len))) > 0) { HASHUpdate(&ctx, buffer, (size_t)nr); |