This is the mail archive of the
cygwin
mailing list for the Cygwin project.
lseek returning 2**32-1 on error instead of -1
- From: Yitzchak Scott-Thoennes <sthoenna at efn dot org>
- To: cygwin at cygwin dot com
- Date: Tue, 20 Apr 2004 17:18:33 -0700
- Subject: lseek returning 2**32-1 on error instead of -1
- Organization: bs"d
Using the latest snapshot 20040420 (though I think it may have been
this way since at least 1.5.2):
$ cat lseeker.c
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main(int argc, char **argv) {
off_t offset = -1, result;
printf ("offsets are size %d.\n", sizeof (off_t));
printf ("offsets are %s.\n", ( offset < 0 ? "signed" : "unsigned" ));
printf ("seeking to offset %lld.\n", offset);
errno = 0;
result = lseek (fileno (stdin), offset, SEEK_CUR);
printf ("got %lld (%s).\n", result, strerror (errno));
return 0;
}
$ gcc -Wall lseeker.c; ./a.exe<lseeker.c
offsets are size 8.
offsets are signed.
seeking to offset -1.
got 4294967295 (Invalid argument).
I believe this to be the cause of perl's op/sysio.t test 39 failing.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/