delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/23/11:30:02

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=oPid4cWWPjT7ZWFWssS/vWyudeeNPN3xbq6z6FuLcjUN3J6o6JTvw
agN+gnPGVDpTv13x5Sumw/QB2zjSKzFGQdvh2nGwCIGByccGBhk6dbR/VfywnnKL
OOfj/viR+a6stJru36/cVldWfUuD+ax0bawuOm9eDN7sKmpCToectQ=
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=Ca1SL1F8SYhTo3QNFgaehuJRxw4=; b=cuEKksy5EgCn4te17Wvi3TMFDPCD
439Dni3Ml9FrYEUJI6vs9T+d1roBgXYt5fhQSbMVyf+Nnm8xEIVbP0B6pu/abZ1b
qKu1IFuIUjlP/kB35hdzfxmZD+W5dsAP+FPIfUGFoQw+/ngRj16IdBmNn9xEcyhU
LGjhtD75ZN41JJ4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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: Wed, 23 Apr 2014 17:29:40 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin's writev() non-standard behavior
Message-ID: <20140423152940.GM2339@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20140423140635 DOT 156430 AT gmx DOT com>
MIME-Version: 1.0
In-Reply-To: <20140423140635.156430@gmx.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--Li7ckgedzMh1NgdW
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Apr 23 16:06, qq qq wrote:
> writev() does not accept count 0 but it should
>=20
> $ cat test.c
> #include <stdio.h>
> #include <errno.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/uio.h>
>=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

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019