I forgot to add that the same binary copy of the executable of the test
program (compiled under 1.7) works without error if I place the
cygwin1.dll version 1.5 into the same directory.
cygwin wrote:
I wrote a small test program to isolate the problem from RSYNC.
The problem occurs when a file descriptor obtained from socketpair()
is dup2()'ed into STDIN and then closed. The close call fails.
Output from the program is as follows:
socket 1 = 3
socket 2 = 4
dup2 socket 1...
closing socket 1...
close: Socket operation on non-socket
closing socket 1 failed
It is interesting to note that the close() is successful when the dup2
calling sequence is omitted.
Since socketpair() in cygwin appears to use AF_INET sockets to
simulate AF_UNIX it might be interesting to try this on a single INET
socket.
===============================================
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
main()
{
int fd[2];
int res = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
if (res < 0) {
perror("socketpair");
fprintf(stderr, "socketpair failed\n");
exit(1);
}
fprintf(stderr, "socket 1 = %d\n", fd[0]);
fprintf(stderr, "socket 2 = %d\n", fd[1]);
fprintf(stderr, "dup2 socket 1...\n");
res = dup2(fd[0], STDIN_FILENO);
if (res < 0) {
perror("dup2");
fprintf(stderr, "dup2 failed\n");
}
fprintf(stderr, "closing socket 1...\n");
res = close(fd[0] < 0);
if (res < 0) {
perror("close");
fprintf(stderr, "closing socket 1 failed\n");
}
}
=====================================================
--
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