From 9d19f8a5feb465e75351edd9057c995e4b56d33e Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sat, 23 Apr 2005 22:30:08 +0000 Subject: [PATCH] When rsync encountered an empty file list, it behaved differently when pulling files than when pushing files: pulling it output a (mostly) unhelpful error message and then exited with a 0 status, even when the remote side exited with an error code. I changed this to output the normal end summary (when verbose) and to exit with the status intact (just like when pushing files). --- main.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index 42f4a6f9..4cc1d3c1 100644 --- a/main.c +++ b/main.c @@ -163,7 +163,9 @@ static void handle_stats(int f) /* this is the client */ - if (!am_sender) { + if (f < 0 && !am_sender) /* e.g. when we got an empty file list. */ + ; + else if (!am_sender) { /* Read the first two in opposite order because the meaning of * read/write swaps when switching from sender to receiver. */ total_written = read_longint(f); @@ -808,17 +810,16 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]) if (write_batch && !am_server) start_write_batch(f_in); flist = recv_file_list(f_in); - if (!flist || flist->count == 0) { - rprintf(FINFO, "client: nothing to do: " - "perhaps you need to specify some filenames or " - "the --recursive option?\n"); - exit_cleanup(0); - } the_file_list = flist; - local_name = get_local_name(flist,argv[0]); + if (flist && flist->count > 0) { + local_name = get_local_name(flist, argv[0]); - status2 = do_recv(f_in,f_out,flist,local_name); + status2 = do_recv(f_in, f_out, flist, local_name); + } else { + handle_stats(-1); + output_summary(); + } if (pid != -1) { if (verbose > 3) -- 2.34.1