* Copyright (C) 1996-2000 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2003-2020 Wayne Davison
+ * Copyright (C) 2003-2022 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
extern int dry_run;
extern int module_id;
+extern int do_fsync;
extern int protect_args;
extern int modify_window;
extern int relative_paths;
-extern int preserve_times;
+extern int preserve_mtimes;
extern int preserve_xattrs;
+extern int omit_link_times;
extern int preallocate_files;
extern char *module_dir;
extern unsigned int module_dirlen;
#include "case_N.h"
switch_step++;
- if (preserve_times & PRESERVE_LINK_TIMES) {
- preserve_times &= ~PRESERVE_LINK_TIMES;
+ if (!omit_link_times) {
+ omit_link_times = 1;
if (S_ISLNK(stp->st_mode))
return 1;
}
#endif
}
+ if (do_fsync && fsync(ofd) < 0) {
+ int save_errno = errno;
+ rsyserr(FERROR, errno, "fsync failed on %s", full_fname(dest));
+ close(ofd);
+ errno = save_errno;
+ return -1;
+ }
+
if (close(ofd) < 0) {
int save_errno = errno;
- rsyserr(FERROR_XFER, errno, "close failed on %s",
- full_fname(dest));
+ rsyserr(FERROR_XFER, errno, "close failed on %s", full_fname(dest));
errno = save_errno;
return -1;
}
return f1_sec == f2_sec;
if (modify_window < 0)
return f1_sec == f2_sec && f1_nsec == f2_nsec;
- /* The nano seconds doesn't figure into these checks -- time windows don't care about that. */
+ /* The nanoseconds do not figure into these checks -- time windows don't care about that. */
if (f2_sec > f1_sec)
return f2_sec - f1_sec <= modify_window;
return f1_sec - f2_sec <= modify_window;