This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: LFS meets PowerPC - score 0,1
Date: Fri, 18 Jun 1999 14:25:44 +1000
From: Geoff Keating <geoffk@ozemail.com.au>
Apart from that, it looks OK to me.
I noticed that the code `if(__offset >= (1ULL << 32))' is bogus, since
it is incorrect for some large negative offsets. E.g. if __offset is
-4294967296, then the code doesn't report a mmap failure, but instead
silently treats __offset as if it were zero.
Also, surely the code meant to set errno to EINVAL, not -EINVAL.
That is, the check should look something like this instead (rewriting
__offset to offset as you suggested):
if (offset != (off_t) offset)
{
errno = EINVAL;
return MAP_FAILED;
}
This is more portable too, since this doesn't assume that off_t is 32 bits.