X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=Vt0K3DR9SXGhNSlKNzxTtuw53FDiO1scuxiOSdAauXh9jlZy3RURL u5OpOhLkLVoJ16wz3rPqX02LnVMHegxf7d2eDwN21fpuIxaxV7r80Y6Wt00UJALf wL0MP8h7/zqmGj6cKwuJDiaLTXw3KVu2liUvX3kRGUAL8lo/L6Txfg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=jn+Z8xPRZ9VqiK5oNCibVphI/ns=; b=x0DKsjtm7Fa/KNpnFOnq9ADuNSbw eQdZnfJxImU608vi4FI51Ed6HTjr/UsiSvUUeuNICTAh89quRG306YMoTPmw/Z28 vWjq1dI+JblkWY/lncRUipL3fkXsF86E08vE5yBIInGgcEaloi5UdvYjlymAZwOg iOVyAcroscEh+qw= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Date: Fri, 28 Mar 2014 10:31:10 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: open(O_RDWR) and lseek() fail Message-ID: <20140328093110.GA23367@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <5334EF41 DOT 50809 AT redhat DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 28 13:48, Roy wrote: > On Fri, 28 Mar 2014 11:40:49 +0800, Eric Blake wrote: >=20 > >On 03/27/2014 07:29 PM, Roy wrote: > >>Hello list, > >> > >>I wonder why lseek(SEEK_CUR) on open(O_RDWR) fails with errno=3D22, the > >>code works on Linux: > >> > >>#include > >>#include > >>#include > >>#include > >>int main(int argc, char** argv){ > > > >Where's #include ? 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. > > >=20 > 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 --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --J/dobhs11T7y2rNN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIbBAEBAgAGBQJTNUFeAAoJEPU2Bp2uRE+gddwP+KdbaYE1D1MqXkZi87rFGb5I HCqWYnA3bbfRw9IZWycDQcdHeq1Y+GuX286GaVTFUnLIvjOd9TpO51j/0m4H6dTD E/d2c4CLYGyzRSZ2/dEh+xWiGPsgLokhBoQLQDctkrLtJnrdRIZm+Yv3DDygI/kn TKfI4HOvalcjukMGr69A+KKAVB8htFJoM4Z22+mmp/gtjAiIx04r729oipGCEzJy SxJdqV+D3t6vv8xHsdckwrFVhyjkxuqbSIQWaM2MHeLX1/sMJ9s5PU7VidIMCF+8 5VSxp6ALkPXSWFjU4IIm6m5/aofmdN6tnThxcvRyz6Dka/ZqYiUpuhLwar8iN32c El5BaH7KhBDBic4GCYhG0sZu19C7GoJ3OBwnYdIwIyFLpxV1mC913r4e5lv4SucC 1xCyX6ovHDG/hinSuaMNpeoIMlAmzsWYGnd3OJtnRaAl8atFf8SYqRcjq10OkLLU 1JdMJ/j+ywtwAjHphEVMHDNvHnUcdbUzSOiMcwp9h2xcTvZYhrFrK1bD443uoeVy UmdBvIs3M2mXuH0VDocy8DFrH3zpvCypFd7trWok2PSz6nkQOgnaF/0mNWUc8QQs 3Sn3y6LMgUSDvtB/HI0oy8pIVE/VjF8Mf+NiCjrfGJGLHvxNIKwuQL2BJp3HC8cR QmPqq0rBQ9sg4ZPf86Q= =Se4x -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--