moved usage mesage after am_daemon test (I'd broken daemon mode)
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index f557e55..d0b2541 100644 (file)
--- a/main.c
+++ b/main.c
@@ -242,11 +242,13 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
   
 
        if ((pid=do_fork()) == 0) {
+               close(recv_pipe[0]);
                recv_files(f_in,flist,local_name,recv_pipe[1]);
                if (am_daemon) report(-1);
                exit_cleanup(0);
        }
 
+       close(recv_pipe[1]);
        generate_files(f_out,flist,local_name,recv_pipe[0]);
 
        waitpid(pid, &status, 0);
@@ -492,11 +494,6 @@ int main(int argc,char *argv[])
        argv += optind;
        optind = 0;
 
-       if (argc < 1) {
-               usage(FERROR);
-               exit(1);
-       }
-
        signal(SIGCHLD,SIG_IGN);
        signal(SIGINT,SIGNAL_CAST sig_int);
        signal(SIGPIPE,SIGNAL_CAST sig_int);
@@ -506,6 +503,11 @@ int main(int argc,char *argv[])
                return daemon_main();
        }
 
+       if (argc < 1) {
+               usage(FERROR);
+               exit(1);
+       }
+
        if (dry_run)
                verbose = MAX(verbose,1);