From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin's writev() non-standard behavior
Date: Wed, 23 Apr 2014 15:29:00 -0000 [thread overview]
Message-ID: <20140423152940.GM2339@calimero.vinschen.de> (raw)
In-Reply-To: <20140423140635.156430@gmx.com>
[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]
On Apr 23 16:06, qq qq wrote:
> writev() does not accept count 0 but it should
>
> $ cat test.c
> #include <stdio.h>
> #include <errno.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/uio.h>
>
> int main()
> {
> struct iovec vec;
>
> memset(&vec, 0, sizeof(vec));
> if (writev(1, &vec, 0) < 0)
> perror("writev");
> return 0;
> }
>
> Linux:
> $ gcc -Wall test.c
> $ ./a.out
>
> Cygwin:
> $ gcc -Wall test.c
> $ ./a.exe
> writev: Invalid argument
>
> This behavior is buggy per:
>
> 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 <= 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
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
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-04-23 15:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 14:06 qq qq
2014-04-23 14:43 ` Eric Blake
2014-04-23 14:53 ` Eliot Moss
2014-04-23 15:29 ` Corinna Vinschen [this message]
2014-04-23 14:53 qq qq
2014-04-23 16:24 ` Eric Blake
2014-04-23 15:48 qq qq
2014-04-23 16:44 ` Corinna Vinschen
2014-04-23 18:44 ` Christopher Faylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140423152940.GM2339@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).