open(O_RDWR) and lseek() fail

Eric Blake eblake@redhat.com
Fri Mar 28 09:31:00 GMT 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140328/0768a32d/attachment.sig>


More information about the Cygwin mailing list