From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24440 invoked by alias); 23 Apr 2014 15:29:45 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 24429 invoked by uid 89); 23 Apr 2014 15:29:45 -0000 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 Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Apr 2014 15:29:43 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id B79858E142F; Wed, 23 Apr 2014 17:29:40 +0200 (CEST) Date: Wed, 23 Apr 2014 15:29:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Cygwin's writev() non-standard behavior Message-ID: <20140423152940.GM2339@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20140423140635.156430@gmx.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Li7ckgedzMh1NgdW" Content-Disposition: inline In-Reply-To: <20140423140635.156430@gmx.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-04/txt/msg00516.txt.bz2 --Li7ckgedzMh1NgdW Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1307 On Apr 23 16:06, qq qq wrote: > writev() does not accept count 0 but it should >=20 > $ cat test.c > #include > #include > #include > #include > #include >=20 > int main() > { > =C2=A0struct iovec vec; >=20 > =C2=A0memset(&vec, 0, sizeof(vec)); > =C2=A0if (writev(1, &vec, 0) < 0) > =C2=A0 =C2=A0perror("writev"); > =C2=A0return 0; > } >=20 > Linux: > $ gcc -Wall test.c > $ ./a.out >=20 > Cygwin: > $ gcc -Wall test.c > $ ./a.exe > writev: Invalid argument >=20 > This behavior is buggy per: >=20 > =C2=A0 =C2=A0 =C2=A0 EINVAL ... the vector count count is less than zero= or greater than the permitted maximum ... I applied a patch to CVS. There's a central function (check_iovec) checking the validity of the iovec input and this function returns EINVAL if iovlen is <=3D 0, the total number of bytes otherwise. However, check_iovec works fine with iovlen 0 and all the callers (readv/writev/recvmsg/sendmsg) are handling a 0 return from this=20 function, too, so a 0 return is nothing to worry about. Please given the next snapshot from http://cygwin.com/snapshots/ a try. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --Li7ckgedzMh1NgdW Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTV9xkAAoJEPU2Bp2uRE+g7PEP/0nkAOznZRoMiONH/g5+vIGS 74F9fK5ix6Cox1YfRArBAUZrkcl8cw2e5f2ZXRdoMXVnwwhwv9t8LBUSwLTgvyTQ gzsiRAy5UplYJ7qDOnkV6y2DvuL60y+K5YFudoOHwKc0Zqc8KXoSfQinMfklZETl g0mzE/8ibWFEC+mrqWW9Y8kJ1R669tFA9vstz0txH8bcHI9W7hQ0jaobp1W+EA8e 5CxS62c13P/R+NVCHsAjmp1hKkgjIBlGOmBnaOZ4e1NdJdTbGewAn6D3HuO2XTXS BChymezC1kml3Q8wASwXewIRgFUmzm2lBMz6XDLdrAV4finyiwa86D8BzxBK4C9V ywyPcWOKgqGdwc+YawjPsORATxLXCpQZaCYqG1Oox4oaq7LgZtW3MtNx9MzeYpx6 B6mCfEO8PDacV5Xtawc8p+Q3DxLBeRUYdYog2SnMfWwWSs2gyP5EtJoyFFpUbbbk GP5z7XBOUYbCP6Qk/oJFybAtBsSPzJFuS1bsmEBQUf7S5Q04zzQ2aIB1caurOKbG WqTWt5L8WImvt+8x6hcxDuVdBZ5kgZmfmP8gLbqiTCKynJM5e95jqeCO7t0rswsE fqnJ63jRYDrkb9cN6L93kI+7ciFuduwBNqmt9i4/rcDr+y+OIJCJjksk/i1psPwz RNi1muomAylE7mf4zwEm =nv49 -----END PGP SIGNATURE----- --Li7ckgedzMh1NgdW--