diff options
author | Björn Jacke <bj@sernet.de> | 2009-12-09 02:06:17 +0100 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2009-12-09 02:58:40 +0100 |
commit | fd5855608f2704fddf887e3424762d344dc93993 (patch) | |
tree | bbbf414c068b982849001fb32319ad10b0e5b59a /source3/modules | |
parent | b6174662df2d2b1a98ec89237c7cacf02024daef (diff) | |
download | samba-fd5855608f2704fddf887e3424762d344dc93993.tar.gz samba-fd5855608f2704fddf887e3424762d344dc93993.tar.bz2 samba-fd5855608f2704fddf887e3424762d344dc93993.zip |
s3: keep subsecond times on cross-filesystem moves and don't follow links
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/vfs_default.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index ded4b1af27..6e2a5712c8 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -540,6 +540,27 @@ static int copy_reg(const char *source, const char *dest) return -1; /* Try to copy the old file's modtime and access time. */ +#if defined(HAVE_UTIMENSAT) + { + struct timespec ts[2]; + + ts[0] = source_stats.st_ex_atime; + ts[1] = source_stats.st_ex_mtime; + utimensat(AT_FDCWD, dest, ts, AT_SYMLINK_NOFOLLOW); + } +#elif defined(HAVE_UTIMES) + { + struct timeval tv[2]; + + tv[0] = convert_timespec_to_timeval(source_stats.st_ex_atime); + tv[1] = convert_timespec_to_timeval(source_stats.st_ex_mtime); +#ifdef HAVE_LUTIMES + lutimes(dest, tv); +#else + utimes(dest, tv); +#endif + } +#elif defined(HAVE_UTIME) { struct utimbuf tv; @@ -547,6 +568,7 @@ static int copy_reg(const char *source, const char *dest) tv.modtime = convert_timespec_to_time_t(source_stats.st_ex_mtime); utime(dest, &tv); } +#endif if (unlink (source) == -1) return -1; |