This is the mail archive of the
mailing list for the Cygwin project.
lseek + read = ENOENT
- From: Sam Steingold <sds at gnu dot org>
- To: cygwin at cygwin dot com
- Date: Thu, 19 Jan 2006 16:10:25 -0500
- Subject: lseek + read = ENOENT
- Reply-to: sds at gnu dot org
I cannot read the last 4-byte word in a file using lseek + read:
/* file "foo" exists and is large enough - say, 4 MB */
int fd = open("foo",O_RDONLY|O_BINARY);
/* this succeeds and correctly returns the size of file "foo" minus 4 */
/* this returns 0 -- instead of the expected 4 -- and sets errno to ENOENT */
if I run this under gdb and type
several times, eventually read() starts to return 4 and set data to the
value I actually wrote into "foo" last.
I observe this on linux, cygwin and solaris -- what am I doing wrong?
Sam Steingold (http://www.podval.org/~sds) running w2k
http://truepeace.org http://www.savegushkatif.org http://www.palestinefacts.org
http://www.openvotingconsortium.org http://www.dhimmi.com http://www.camera.org
When we break the law, they fine us, when we comply, they tax us.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html