X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/8b35435f7cc4708400c652434615ce48dc493de4..08e5094d7fc2e863b10438a4154580ea95576d59:/main.c diff --git a/main.c b/main.c index 0c4f2cda..2f422e28 100644 --- a/main.c +++ b/main.c @@ -324,9 +324,10 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name) write_int(recv_pipe[1],1); close(recv_pipe[1]); io_flush(); - /* finally we go to sleep until our parent kills us with - a USR2 signal */ - while (1) sleep(60); + /* finally we go to sleep until our parent kills us + with a USR2 signal. We sleepp for a short time as on + some OSes a signal won't interrupt a sleep! */ + while (1) sleep(1); } close(recv_pipe[1]); @@ -417,6 +418,9 @@ void start_server(int f_in, int f_out, int argc, char *argv[]) setup_protocol(f_out, f_in); + set_nonblocking(f_in); + set_nonblocking(f_out); + if (remote_version >= 23) io_start_multiplex_out(f_out); @@ -440,6 +444,9 @@ int client_run(int f_in, int f_out, int pid, int argc, char *argv[]) extern int list_only; extern int remote_version; + set_nonblocking(f_in); + set_nonblocking(f_out); + setup_protocol(f_out,f_in); if (remote_version >= 23) @@ -695,6 +702,8 @@ int main(int argc,char *argv[]) #endif if (am_server) { + set_nonblocking(STDIN_FILENO); + set_nonblocking(STDOUT_FILENO); start_server(STDIN_FILENO, STDOUT_FILENO, argc, argv); }