This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rsync + xp sp2 failing

On Sep 9,  9:36am, (Joel) wrote:
-- Subject: rsync + xp sp2 failing
> Failed to dup/close : Socket operation on non-socket
> rsync error: error in IPC code (code 14)@
> /home/lapo/package/tmp/rsync-2.6.2/pipe.c(73)
-- End of excerpt from Joel

The rsync code in pipe.c looks like ...

                if (dup2(to_child_pipe[0], STDIN_FILENO) < 0 ||
                    close(to_child_pipe[1]) < 0 ||
                    close(from_child_pipe[0]) < 0 ||
                    dup2(from_child_pipe[1], STDOUT_FILENO) < 0) {
                        rprintf(FERROR, "Failed to dup/close : %s\n",

... so we need to determine why dup2 or close is failing.

The "pipes" are created earlier by fd_pair ...

        int to_child_pipe[2];
        int from_child_pipe[2];


        if (fd_pair(to_child_pipe) < 0 || fd_pair(from_child_pipe) < 0) {
                rprintf(FERROR, "pipe: %s\n", strerror(errno));

... but they are in fact not pipes at all; they're actually socketpairs,
for platforms like Cygwin that support socketpairs:

 * Create a file descriptor pair - like pipe() but use socketpair if
 * possible (because of blocking issues on pipes).
 * Always set non-blocking.
int fd_pair(int fd[2])
        int ret;

        ret = socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
        ret = pipe(fd);

        if (ret == 0) {

        return ret;

Cygwin always uses inet sockets to implement socketpairs, even
for AF_UNIX.  That partially explains "Socket operation on non-socket".

Has anything changed recently in the socketpair code?
This seems unrelated to my recent implementation of selectable pipes.

If you can reproduce this using strace, the last hundred lines or so
of the strace output might be enlightening.


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]