From df5cd107a57a592b196add0aac7642b89ac261b0 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 14 Apr 2004 16:51:48 +0000 Subject: [PATCH] Moved (and expanded) a verbose message from clientserver.c to socket.c to solve an old FIXME comment. --- clientserver.c | 10 +--------- socket.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/clientserver.c b/clientserver.c index 13e52f3d..6c2e6d9a 100644 --- a/clientserver.c +++ b/clientserver.c @@ -87,18 +87,10 @@ int start_socket_client(char *host, char *path, int argc, char *argv[]) *p = 0; } - if (verbose >= 2) { - /* FIXME: If we're going to use a socket program for - * testing, then this message is wrong. We need to - * say something like "(except really using %s)" */ - rprintf(FINFO, "opening tcp connection to %s port %d\n", - host, rsync_port); - } fd = open_socket_out_wrapped(host, rsync_port, bind_address, default_af_hint); - if (fd == -1) { + if (fd == -1) exit_cleanup(RERR_SOCKETIO); - } ret = start_inband_exchange(user, path, fd, fd, argc); diff --git a/socket.c b/socket.c index 140480bc..264c5321 100644 --- a/socket.c +++ b/socket.c @@ -299,9 +299,14 @@ int open_socket_out(char *host, int port, const char *bind_address, int open_socket_out_wrapped(char *host, int port, const char *bind_address, int af_hint) { - char *prog; + char *prog = getenv("RSYNC_CONNECT_PROG"); - if ((prog = getenv("RSYNC_CONNECT_PROG")) != NULL) + if (verbose >= 2) { + rprintf(FINFO, "%sopening tcp connection to %s port %d\n", + prog ? "Using RSYNC_CONNECT_PROG instead of " : "", + host, port); + } + if (prog) return sock_exec(prog); return open_socket_out(host, port, bind_address, af_hint); } @@ -769,18 +774,14 @@ int sock_exec(const char *prog) strerror(errno)); return -1; } + if (verbose >= 2) + rprintf(FINFO, "Running socket program: \"%s\"\n", prog); if (fork() == 0) { close(fd[0]); close(0); close(1); dup(fd[1]); dup(fd[1]); - 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]); -- 2.34.1