64 bit pread

From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 02/27/04


Date: Fri, 27 Feb 2004 16:36:22 +0100

I have a program where I use 64 bit file offsets.
Before any includes I have:

#define _GNU_SOURCE
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#define _XOPEN_SOURCE 500

Are those lines correct? When I trace my program
I see this:

pread(3, "\0\0\0\10"..., 512, 140737488392704) = 512

The file offset is wrong, that is a bug in my
program. What I wonder about is the return value.
Why does pread report success? The file is only
348KB.

Shouldn't pread report an error code or zero bytes
read, when the offset is beyond the end of the
file?

I'm trying this on Red Hat Linux 9.

-- 
Kasper Dupont -- der bruger for meget tid paa usenet.
For sending spam use mailto:aaarep@daimi.au.dk
/* Would you like fries with that? */