Delay the renaming of all the temp files until the end of the transfer.
---- orig/options.c 2005-01-17 23:11:45
-+++ options.c 2005-01-17 23:15:13
-@@ -97,6 +97,7 @@ int modify_window = 0;
+--- orig/options.c 2005-01-23 01:45:43
++++ options.c 2005-01-23 07:27:59
+@@ -99,6 +99,7 @@ int modify_window = 0;
int blocking_io = -1;
int checksum_seed = 0;
int inplace = 0;
long block_size = 0; /* "long" because popt can't set an int32. */
-@@ -278,6 +279,7 @@ void usage(enum logcode F)
- rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n");
- rprintf(F," --partial keep partially transferred files\n");
- rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
+@@ -273,6 +274,7 @@ void usage(enum logcode F)
+ rprintf(F," --rsync-path=PATH specify path to rsync on the remote machine\n");
+ rprintf(F," --existing only update files that already exist\n");
+ rprintf(F," --ignore-existing ignore files that already exist on receiving side\n");
+ rprintf(F," --delay-renames renames transferred files into place at end\n");
- rprintf(F," --force force deletion of directories even if not empty\n");
- rprintf(F," --numeric-ids don't map uid/gid values by user/group name\n");
- rprintf(F," --timeout=TIME set I/O timeout in seconds\n");
-@@ -390,6 +392,7 @@ static struct poptOption long_options[]
+ rprintf(F," --delete delete files that don't exist on the sending side\n");
+ rprintf(F," --delete-after receiver deletes after transferring, not before\n");
+ rprintf(F," --delete-excluded also delete excluded files on the receiving side\n");
+@@ -394,6 +396,7 @@ static struct poptOption long_options[]
{"progress", 0, POPT_ARG_NONE, &do_progress, 0, 0, 0 },
{"partial", 0, POPT_ARG_NONE, &keep_partial, 0, 0, 0 },
{"partial-dir", 0, POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
{"ignore-errors", 0, POPT_ARG_NONE, &ignore_errors, 0, 0, 0 },
{"blocking-io", 0, POPT_ARG_VAL, &blocking_io, 1, 0, 0 },
{"no-blocking-io", 0, POPT_ARG_VAL, &blocking_io, 0, 0, 0 },
-@@ -944,11 +947,15 @@ int parse_arguments(int *argc, const cha
+@@ -948,11 +951,15 @@ int parse_arguments(int *argc, const cha
bwlimit_writemax = 512;
}
return 0;
}
keep_partial = 0;
-@@ -1179,6 +1186,8 @@ void server_options(char **args,int *arg
+@@ -1187,6 +1194,8 @@ void server_options(char **args,int *arg
if (partial_dir && am_sender) {
args[ac++] = "--partial-dir";
args[ac++] = partial_dir;
} else if (keep_partial)
args[ac++] = "--partial";
---- orig/receiver.c 2005-01-17 23:11:45
+--- orig/receiver.c 2005-01-23 07:27:24
+++ receiver.c 2005-01-10 10:16:54
@@ -53,6 +53,7 @@ extern int orig_umask;
extern int keep_partial;
extern struct exclude_list_struct server_exclude_list;
-@@ -345,6 +346,7 @@ int recv_files(int f_in, struct file_lis
+@@ -324,6 +325,7 @@ int recv_files(int f_in, struct file_lis
char fnametmp[MAXPATHLEN];
char *fnamecmp, *partialptr;
char fnamecmpbuf[MAXPATHLEN];
struct file_struct *file;
struct stats initial_stats;
int save_make_backups = make_backups;
-@@ -358,6 +360,12 @@ int recv_files(int f_in, struct file_lis
+@@ -337,6 +339,12 @@ int recv_files(int f_in, struct file_lis
flist->hlink_pool = NULL;
}
while (1) {
cleanup_disable();
-@@ -572,7 +580,7 @@ int recv_files(int f_in, struct file_lis
+@@ -551,7 +559,7 @@ int recv_files(int f_in, struct file_lis
exit_cleanup(RERR_FILEIO);
}
finish_transfer(fname, fnametmp, file, recv_ok, 1);
if (partialptr != fname && fnamecmp == partialptr) {
do_unlink(partialptr);
-@@ -582,6 +590,8 @@ int recv_files(int f_in, struct file_lis
+@@ -561,6 +569,8 @@ int recv_files(int f_in, struct file_lis
&& handle_partial_dir(partialptr, PDIR_CREATE)) {
finish_transfer(partialptr, fnametmp, file, recv_ok,
!partial_dir);
} else {
partialptr = NULL;
do_unlink(fnametmp);
-@@ -621,6 +631,33 @@ int recv_files(int f_in, struct file_lis
+@@ -600,6 +610,33 @@ int recv_files(int f_in, struct file_lis
}
make_backups = save_make_backups;
if (delete_after && recurse && !local_name && flist->count > 0)
delete_files(flist);
---- orig/rsync.yo 2005-01-17 23:11:46
-+++ rsync.yo 2005-01-17 23:13:23
-@@ -348,6 +348,7 @@ verb(
- --max-size=SIZE don't transfer any file larger than SIZE
- --partial keep partially transferred files
- --partial-dir=DIR put a partially transferred file into DIR
+--- orig/rsync.yo 2005-01-22 22:48:52
++++ rsync.yo 2005-01-23 07:28:13
+@@ -340,6 +340,7 @@ verb(
+ --rsync-path=PATH specify path to rsync on the remote machine
+ --existing only update files that already exist
+ --ignore-existing ignore files that already exist on receiver
+ --delay-renames renames transferred files into place at end
- --force force deletion of dirs even if not empty
- --numeric-ids don't map uid/gid values by user/group name
- --timeout=TIME set I/O timeout in seconds
+ --delete delete files that don't exist on sender
+ --delete-after receiver deletes after transfer, not before
+ --delete-excluded also delete excluded files on receiver
@@ -546,9 +547,9 @@ or appended data, and also on systems th
bound.