aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2012-05-05 08:01:09 -0700
committerWayne Davison <wayned@samba.org>2012-05-05 08:01:09 -0700
commitd51a3adb4fca3e6b1b046c6e570828f3bca8fe36 (patch)
treeb7d5b2126a21e6d6cd225447bd73316cca9da0c5
parentb55115ec6f127f7def2dfcc907bf6e28d775e53c (diff)
downloadandroid_external_rsync-d51a3adb4fca3e6b1b046c6e570828f3bca8fe36.tar.gz
android_external_rsync-d51a3adb4fca3e6b1b046c6e570828f3bca8fe36.tar.bz2
android_external_rsync-d51a3adb4fca3e6b1b046c6e570828f3bca8fe36.zip
Set the modtime to 0 on a partial file.
Fixes debian bug 624826.
-rw-r--r--cleanup.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cleanup.c b/cleanup.c
index cf5f2122..147c3a7c 100644
--- a/cleanup.c
+++ b/cleanup.c
@@ -158,6 +158,7 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
if (cleanup_got_literal && cleanup_fname && cleanup_new_fname
&& keep_partial && handle_partial_dir(cleanup_new_fname, PDIR_CREATE)) {
+ int tweak_modtime = 0;
const char *fname = cleanup_fname;
cleanup_fname = NULL;
if (cleanup_fd_r != -1)
@@ -166,8 +167,15 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
flush_write_file(cleanup_fd_w);
close(cleanup_fd_w);
}
+ if (!partial_dir) {
+ /* We don't want to leave a partial file with a modern time or it
+ * could be skipped via --update. Setting the time to something
+ * really old also helps it to stand out as unfinished in an ls. */
+ tweak_modtime = 1;
+ cleanup_file->modtime = 0;
+ }
finish_transfer(cleanup_new_fname, fname, NULL, NULL,
- cleanup_file, 0, !partial_dir);
+ cleanup_file, tweak_modtime, !partial_dir);
}
/* FALLTHROUGH */