I was testing the behavior when pipe() fails, in order to propose an update to POSIX wording: http://austingroupbugs.net/view.php?id=467
However, cygwin's pipe implementation dumps core when it runs out of fds, so I could not definitively state whether cygwin properly leaves the fd array unchanged on error, the way Linux does. According to a gdb run and while using stock 1.7.9 cygwin1.dll, the crash is in fhandler_pipe::create(). #define _POSIX_C_SOURCE 200811L #include <unistd.h> #include <string.h> #include <stdio.h> #include <errno.h> int main (int argc, char **argv) { int i = 0; while (1) { int fd[2] = {-2,-3}; int err = pipe(fd); if (err) { printf ("iteration %d, pipe returned %d errno %d %s, fds %d %d\n", i, err, errno, strerror(errno), fd[0], fd[1]); break; } i++; } return 0; } Expected behavior is EMFILE and fd unchanged, after however many iterations it takes to reach the ulimit on max fd. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature