summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-08-01 17:53:43 -0700
committerWayne Davison <wayned@samba.org>2008-08-01 18:00:09 -0700
commitfa181223d82bcc3845241bf2b4df03ab3f9159aa (patch)
treebe363c17cf0895be12f4e2e863af165d8ccb6503
parent9ed569486f12982605e08117113f150fa38827ab (diff)
downloadrsync-fa181223d82bcc3845241bf2b4df03ab3f9159aa.tar.gz
rsync-fa181223d82bcc3845241bf2b4df03ab3f9159aa.tar.bz2
rsync-fa181223d82bcc3845241bf2b4df03ab3f9159aa.zip
Properly handle a failure to create a partial directory, which is
especially important for --delay-updates, particularly when --remove-source-files was also specified.
-rw-r--r--NEWS5
-rw-r--r--receiver.c23
2 files changed, 20 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 29f1ef2e..12e45e86 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,11 @@ Changes since 3.0.3:
- Fixed the hard-linking of files from a device that has a device number
of 0 (which seems to be a common device number on NetBSD).
+ - Fixed the handling of a --partial-dir that cannot be created. This
+ particularly impacts the --delay-updates option (since the files cannot
+ be delayed without a partial-dir), and was potentially destructive if
+ the --remove-source-files was also specified.
+
- Fixed a couple issues in the --fake-super handling of xattrs when the
destination files have root-level attributes (e.g. selinux values) that
a non-root copy can't affect.
diff --git a/receiver.c b/receiver.c
index ce6b7394..1ff029d4 100644
--- a/receiver.c
+++ b/receiver.c
@@ -698,23 +698,30 @@ int recv_files(int f_in, char *local_name)
do_unlink(partialptr);
handle_partial_dir(partialptr, PDIR_DELETE);
}
- } else if (keep_partial && partialptr
- && handle_partial_dir(partialptr, PDIR_CREATE)) {
- if (!finish_transfer(partialptr, fnametmp, fnamecmp, NULL,
- file, recv_ok, !partial_dir))
+ } else if (keep_partial && partialptr) {
+ if (!handle_partial_dir(partialptr, PDIR_CREATE)) {
+ rprintf(FERROR,
+ "Unable to create partial-dir for %s -- discarding %s.\n",
+ local_name ? local_name : f_name(file, NULL),
+ recv_ok ? "completed file" : "partial file");
+ do_unlink(fnametmp);
+ recv_ok = -1;
+ } else if (!finish_transfer(partialptr, fnametmp, fnamecmp, NULL,
+ file, recv_ok, !partial_dir))
recv_ok = -1;
else if (delay_updates && recv_ok) {
bitbag_set_bit(delayed_bits, ndx);
recv_ok = 2;
- }
- } else {
- partialptr = NULL;
+ } else
+ partialptr = NULL;
+ } else
do_unlink(fnametmp);
- }
cleanup_disable();
switch (recv_ok) {
+ case 2:
+ break;
case 1:
if (remove_source_files || inc_recurse
|| (preserve_hard_links && F_IS_HLINKED(file)))