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]

Re: open(O_RDWR) and lseek() fail


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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]