X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/0f9555207a9549a0340d8de49abe9a9438be7018..5d2640376e3b5b21f6049161b55baf6f4e2acce8:/socket.c diff --git a/socket.c b/socket.c index eb1ab3f5..88228046 100644 --- a/socket.c +++ b/socket.c @@ -817,16 +817,26 @@ static int socketpair_tcp(int fd[2]) } -/******************************************************************* -run a program on a local tcp socket, this is used to launch smbd -when regression testing -the return value is a socket which is attached to a subprocess -running "prog". stdin and stdout are attached. stderr is left -attached to the original stderr - ******************************************************************/ + +/** + * Run a program on a local tcp socket, so that we can talk to it's + * stdin and stdout. This is used to launch ssh and similar + * connection helper programs for rsync. + * + * @return a socket which is attached to a subprocess running + * "prog". stdin and stdout are attached. stderr is left attached to + * the original stderr + **/ int sock_exec(const char *prog) { int fd[2]; + + if (verbose > 0) { + rprintf(FINFO, RSYNC_NAME + ": open connection using \"%s\"\n", + prog); + } + if (socketpair_tcp(fd) != 0) { rprintf (FERROR, RSYNC_NAME ": socketpair_tcp failed (%s)\n", @@ -839,10 +849,12 @@ int sock_exec(const char *prog) close(1); dup(fd[1]); dup(fd[1]); - if (verbose > 3) + if (verbose > 3) { + /* Can't use rprintf because we've forked. */ fprintf (stderr, RSYNC_NAME ": execute socket program \"%s\"\n", prog); + } exit (system (prog)); } close (fd[1]);