Another try at socklen_t: just check for it, and otherwise use int.
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index 63fab0d..bc51571 100644 (file)
--- 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);
        }
@@ -700,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[])