|
|
eab3d9 |
From 0f8e9e2d8638e47d646a6baba694b303ac84e695 Mon Sep 17 00:00:00 2001
|
|
|
eab3d9 |
From: Wayne Davison <wayned@samba.org>
|
|
|
eab3d9 |
Date: Mon, 15 Jan 2018 10:52:15 -0800
|
|
|
eab3d9 |
Subject: [PATCH 1/1] Don't force nanoseconds if a file wasn't transferred or
|
|
|
eab3d9 |
checksummed.
|
|
|
eab3d9 |
|
|
|
eab3d9 |
---
|
|
|
eab3d9 |
backup.c | 2 +-
|
|
|
eab3d9 |
generator.c | 5 ++++-
|
|
|
eab3d9 |
rsync.c | 6 +++---
|
|
|
eab3d9 |
rsync.h | 1 +
|
|
|
eab3d9 |
4 files changed, 9 insertions(+), 5 deletions(-)
|
|
|
eab3d9 |
|
|
|
eab3d9 |
diff --git a/backup.c b/backup.c
|
|
|
eab3d9 |
index bc565329..5f40b39a 100644
|
|
|
eab3d9 |
--- a/backup.c
|
|
|
eab3d9 |
+++ b/backup.c
|
|
|
eab3d9 |
@@ -336,7 +336,7 @@ int make_backup(const char *fname, BOOL prefer_rename)
|
|
|
eab3d9 |
|
|
|
eab3d9 |
save_preserve_xattrs = preserve_xattrs;
|
|
|
eab3d9 |
preserve_xattrs = 0;
|
|
|
eab3d9 |
- set_file_attrs(buf, file, NULL, fname, 0);
|
|
|
eab3d9 |
+ set_file_attrs(buf, file, NULL, fname, ATTRS_SET_NANO);
|
|
|
eab3d9 |
preserve_xattrs = save_preserve_xattrs;
|
|
|
eab3d9 |
|
|
|
eab3d9 |
unmake_file(file);
|
|
|
eab3d9 |
diff --git a/generator.c b/generator.c
|
|
|
eab3d9 |
index 4b0a60e4..a112da6e 100644
|
|
|
eab3d9 |
--- a/generator.c
|
|
|
eab3d9 |
+++ b/generator.c
|
|
|
eab3d9 |
@@ -99,6 +99,7 @@ extern struct file_list *cur_flist, *first_flist, *dir_flist;
|
|
|
eab3d9 |
extern filter_rule_list filter_list, daemon_filter_list;
|
|
|
eab3d9 |
|
|
|
eab3d9 |
int maybe_ATTRS_REPORT = 0;
|
|
|
eab3d9 |
+int maybe_ATTRS_SET_NANO = 0;
|
|
|
eab3d9 |
|
|
|
eab3d9 |
static dev_t dev_zero;
|
|
|
eab3d9 |
static int deldelay_size = 0, deldelay_cnt = 0;
|
|
|
eab3d9 |
@@ -1214,6 +1215,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|
|
eab3d9 |
return;
|
|
|
eab3d9 |
}
|
|
|
eab3d9 |
|
|
|
eab3d9 |
+ maybe_ATTRS_SET_NANO = always_checksum ? ATTRS_SET_NANO : 0;
|
|
|
eab3d9 |
+
|
|
|
eab3d9 |
if (skip_dir) {
|
|
|
eab3d9 |
if (is_below(file, skip_dir)) {
|
|
|
eab3d9 |
if (is_dir)
|
|
|
eab3d9 |
@@ -1762,7 +1765,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
|
|
eab3d9 |
do_unlink(partialptr);
|
|
|
eab3d9 |
handle_partial_dir(partialptr, PDIR_DELETE);
|
|
|
eab3d9 |
}
|
|
|
eab3d9 |
- set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
|
|
|
eab3d9 |
+ set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT | maybe_ATTRS_SET_NANO);
|
|
|
eab3d9 |
if (itemizing)
|
|
|
eab3d9 |
itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
|
|
|
eab3d9 |
#ifdef SUPPORT_HARD_LINKS
|
|
|
eab3d9 |
diff --git a/rsync.c b/rsync.c
|
|
|
eab3d9 |
index ae036a6b..a0b948dc 100644
|
|
|
eab3d9 |
--- a/rsync.c
|
|
|
eab3d9 |
+++ b/rsync.c
|
|
|
eab3d9 |
@@ -556,7 +556,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
|
|
eab3d9 |
if (!(flags & ATTRS_SKIP_MTIME)
|
|
|
eab3d9 |
&& (sxp->st.st_mtime != file->modtime
|
|
|
eab3d9 |
#ifdef ST_MTIME_NSEC
|
|
|
eab3d9 |
- || (NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
|
|
|
eab3d9 |
+ || (flags & ATTRS_SET_NANO && NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
|
|
|
eab3d9 |
#endif
|
|
|
eab3d9 |
)) {
|
|
|
eab3d9 |
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode);
|
|
|
eab3d9 |
@@ -672,7 +672,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
|
|
|
eab3d9 |
|
|
|
eab3d9 |
/* Change permissions before putting the file into place. */
|
|
|
eab3d9 |
set_file_attrs(fnametmp, file, NULL, fnamecmp,
|
|
|
eab3d9 |
- ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
|
|
|
eab3d9 |
+ ok_to_set_time ? ATTRS_SET_NANO : ATTRS_SKIP_MTIME);
|
|
|
eab3d9 |
|
|
|
eab3d9 |
/* move tmp file over real file */
|
|
|
eab3d9 |
if (DEBUG_GTE(RECV, 1))
|
|
|
eab3d9 |
@@ -697,7 +697,7 @@ int finish_transfer(const char *fname, const char *fnametmp,
|
|
|
eab3d9 |
|
|
|
eab3d9 |
do_set_file_attrs:
|
|
|
eab3d9 |
set_file_attrs(fnametmp, file, NULL, fnamecmp,
|
|
|
eab3d9 |
- ok_to_set_time ? 0 : ATTRS_SKIP_MTIME);
|
|
|
eab3d9 |
+ ok_to_set_time ? ATTRS_SET_NANO : ATTRS_SKIP_MTIME);
|
|
|
eab3d9 |
|
|
|
eab3d9 |
if (temp_copy_name) {
|
|
|
eab3d9 |
if (do_rename(fnametmp, fname) < 0) {
|
|
|
eab3d9 |
diff --git a/rsync.h b/rsync.h
|
|
|
eab3d9 |
index 6c732db3..53fff2d6 100644
|
|
|
eab3d9 |
--- a/rsync.h
|
|
|
eab3d9 |
+++ b/rsync.h
|
|
|
eab3d9 |
@@ -165,6 +165,7 @@
|
|
|
eab3d9 |
|
|
|
eab3d9 |
#define ATTRS_REPORT (1<<0)
|
|
|
eab3d9 |
#define ATTRS_SKIP_MTIME (1<<1)
|
|
|
eab3d9 |
+#define ATTRS_SET_NANO (1<<2)
|
|
|
eab3d9 |
|
|
|
eab3d9 |
#define FULL_FLUSH 1
|
|
|
eab3d9 |
#define NORMAL_FLUSH 0
|
|
|
eab3d9 |
--
|
|
|
eab3d9 |
2.23.0
|