X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/19b27a485e833e08160ef0bae8f604c6f60e5ef8..fab9a9c54729984199d20b637ea8cc163c73d2e2:/main.c diff --git a/main.c b/main.c index f696474c..bc51571f 100644 --- a/main.c +++ b/main.c @@ -360,7 +360,8 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name) /* finally we go to sleep until our parent kills us with a USR2 signal. We sleep for a short time as on some OSes a signal won't interrupt a sleep! */ - while (1) msleep(20); + while (msleep(20)) + ; } close(recv_pipe[1]); @@ -504,16 +505,16 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[]) rprintf(FINFO,"file list sent\n"); send_files(flist,f_out,f_in); + if (remote_version >= 24) { + /* final goodbye message */ + read_int(f_in); + } if (pid != -1) { if (verbose > 3) rprintf(FINFO,"client_run waiting on %d\n",pid); io_flush(); wait_process(pid, &status); } - if (remote_version >= 24) { - /* final goodbye message */ - read_int(f_in); - } report(-1); exit_cleanup(status); } @@ -581,6 +582,7 @@ static int start_client(int argc, char *argv[]) extern int am_sender; extern char *shell_cmd; extern int rsync_port; + extern int whole_file; char *argv0 = strdup(argv[0]); if (strncasecmp(URL_PREFIX, argv0, strlen(URL_PREFIX)) == 0) { @@ -627,6 +629,8 @@ static int start_client(int argc, char *argv[]) p = find_colon(argv[argc-1]); if (!p) { local_server = 1; + /* disable "rsync algorithm" when both sides local */ + whole_file = 1; } else if (p[1] == ':') { *p = 0; return start_socket_client(argv[argc-1], p+2, argc-1, argv); @@ -697,6 +701,9 @@ static RETSIGTYPE sigusr2_handler(int val) { } static RETSIGTYPE sigchld_handler(int val) { +#ifdef WNOHANG + while (waitpid(-1, NULL, WNOHANG) > 0) ; +#endif } int main(int argc,char *argv[])