check argc and show usage if no args
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index e9a0039..b4c514f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -48,8 +48,8 @@ static void report(int f)
                out = write_total();
                tsize = total_size;
        } else {
-               in = read_longint(f);
                out = read_longint(f);
+               in = read_longint(f);
                tsize = read_longint(f);
        }
        
@@ -222,8 +222,6 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
                argv[0] = ".";
        }
        
-       rprintf(FINFO,"sending file list\n");
-       
        flist = send_file_list(f_out,argc,argv);
        send_files(flist,f_out,f_in);
        report(f_out);
@@ -496,6 +494,11 @@ int main(int argc,char *argv[])
        starttime = time(NULL);
        am_root = (getuid() == 0);
 
+       if (argc < 2) {
+               usage(FERROR);
+               exit(1);
+       }
+
        /* we set a 0 umask so that correct file permissions can be
           carried across */
        orig_umask = (int)umask(0);