Cygwin's writev() non-standard behavior

qq qq miska0000@gmx.com
Wed Apr 23 14:53:00 GMT 2014


> furthermore, cygwin should emulate Linux behavior, even if POSIX
> doesn't define the behavior.

And which is why I compared Linux vs. Cygwin in my original post ?

> so your argument is flawed - you have triggered undefined behavior.

Same difference:
$ cat test.c
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/uio.h>

int main()
{
  struct iovec vec;
  int fd = open("test.out", O_WRONLY | O_CREAT, 0666);
  memset(&vec, 0, sizeof(vec));
  if (writev(fd, &vec, 0) < 0)
    perror("writev");
  return 0;
}

Linux:
$ gcc -Wall test.c
$ ./a.out

Cygwin:
$ gcc -Wall test.c
$ ./a.exe
writev: Invalid argument

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list