Cygwin's writev() non-standard behavior
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Apr 23 15:29:00 GMT 2014
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20140423/cc203d3b/attachment.sig>
More information about the Cygwin
mailing list