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 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.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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