This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mar 28 13:48, Roy wrote: > On Fri, 28 Mar 2014 11:40:49 +0800, Eric Blake <eblake@redhat.com> wrote: > > >On 03/27/2014 07:29 PM, Roy wrote: > >>Hello list, > >> > >>I wonder why lseek(SEEK_CUR) on open(O_RDWR) fails with errno=22, the > >>code works on Linux: > >> > >>#include <stdio.h> > >>#include <errno.h> > >>#include <stdlib.h> > >>#include <fcntl.h> > >>int main(int argc, char** argv){ > > > >Where's #include <unistd.h>? It fails because you are missing the > >prototype for lseeks, which means that the C compiler is trying to call > >it with 'int offset' instead of 'off_t offset'. Compile with -Wall. > > > >> > >>Whats wrong with cygwin? > > > >Rather, fix the bugs in your code, and let the compiler help you. > > > > Got it, but why enforcing the use of off_t here? > I'm not going to use 64bit offsets. It doesn't matter what you use, it matters what the function expects. lseek expects off_t per POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html and off_t is defined as 64 bit type. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
Attachment:
pgpKePMGa7xFH.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |