One serious bug in glibc 2.0/2.1
Richard Henderson
rth@cygnus.com
Sat Aug 8 15:43:00 GMT 1998
On Thu, Aug 06, 1998 at 07:30:49AM -0700, H.J. Lu wrote:
> There is one serious bug in glibc 2.0/2.1 in dealing with system
> calls. glibc assumes system calls returns int.
No it doesn't.
> At least, lseek is not handled right on alpha.
No it isn't.
> Return -1 as long turns into -1 as int which is 0xffffffff in long.
No it isn't. 32-bit integers -- signed _or_ unsigned -- are always
kept in canonical sign-extended form on Alpha.
As proof that lseek returns the proper value:
#include <unistd.h>
#include <sys/types.h>
main()
{
off_t x = lseek(-1, -1, -1);
printf("%lx\n", x);
}
does print ffffffffffffffff.
r~
More information about the Libc-hacker
mailing list