open(O_RDWR) and lseek() fail

Roy roytam@gmail.com
Fri Mar 28 12:53:00 GMT 2014


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



More information about the Cygwin mailing list