We now conditionally turn on whole_file in do_cmd() right before
[rsync/rsync.git] / main.c
diff --git a/main.c b/main.c
index f71d46c..0ec6dee 100644 (file)
--- a/main.c
+++ b/main.c
@@ -49,6 +49,7 @@ extern int protocol_version;
 extern int recurse;
 extern int relative_paths;
 extern int rsync_port;
+extern int whole_file;
 extern int read_batch;
 extern int write_batch;
 extern int filesfrom_fd;
@@ -302,6 +303,10 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char *path,
        if (local_server) {
                if (read_batch)
                        create_flist_from_batch(); /* sets batch_flist */
+               /* If the user didn't request --[no-]whole-file, force
+                * it on, but only if we're not batch processing. */
+               if (whole_file < 0 && !read_batch && !write_batch)
+                       whole_file = 1;
                ret = local_child(argc, args, f_in, f_out, child_main);
        } else {
                ret = piped_child(args,f_in,f_out);
@@ -401,7 +406,7 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
        }
 
        if (argc == 0 && recurse) {
-               argc=1;
+               argc = 1;
                argv--;
                argv[0] = ".";
        }
@@ -428,7 +433,7 @@ static void do_server_sender(int f_in, int f_out, int argc,char *argv[])
 static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
 {
        int pid;
-       int status=0;
+       int status = 0;
        int error_pipe[2];
 
        if (preserve_hard_links)
@@ -448,7 +453,7 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name)
 
        io_flush(NORMAL_FLUSH);
 
-       if ((pid=do_fork()) == 0) {
+       if ((pid = do_fork()) == 0) {
                close(error_pipe[0]);
                if (f_in != f_out)
                        close(f_out);