On Mon, Mar 21, 2011 at 11:42:30AM +0100, Pavel Sanda wrote: > Pavel Sanda wrote: > > Vincent van Ravesteijn wrote: > > > According to the code: bytes_end = bytes_begin + info.st_size, which > > > would > > > mean info.st_size is 150 MB ? > > > > > > Is fstat failing in this case, or did you really have a file of 150MB ? > > > > and in any case we do not check for return value of fstat, which looks > > wrong. > > does this patch help? > p
> diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp > index 54c6fc9..7adbfa6 100644 > --- a/src/support/FileName.cpp > +++ b/src/support/FileName.cpp > @@ -543,7 +543,9 @@ unsigned long FileName::checksum() const > return result; > > struct stat info; > - fstat(fd, &info); > + if (!fstat(fd, &info)) > + return result; Hmmm... note that fstat returns zero on success, and -1 on error... > > void * mm = mmap(0, info.st_size, PROT_READ, > MAP_PRIVATE, fd, 0); -- Enrico