summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKan-Ru Chen <kanru@0xlab.org>2010-07-05 17:04:37 +0800
committerKan-Ru Chen <kanru@0xlab.org>2010-07-05 17:43:51 +0800
commita67bc11058f47eeba1f8bb30173c73ec0af8fcce (patch)
tree651a77ce21c3ede98aa8978fa6aeebae2ebe3e6d
parent45038e062dc20c4684b293875841b9e638d2df5c (diff)
downloadbuild-a67bc11058f47eeba1f8bb30173c73ec0af8fcce.zip
build-a67bc11058f47eeba1f8bb30173c73ec0af8fcce.tar.gz
build-a67bc11058f47eeba1f8bb30173c73ec0af8fcce.tar.bz2
acp: Ensure dst mtime always greater or equal to src mtime
When copying files from file systems that support high resolution mtime, we should not truncating the nsec part. Instead we should increase the dst mtime by one sec to prevent dst mtime to become less than src mtime. Change-Id: I5cab1edd4b9783ec0e3ceb04ed833d8bbba00b19
-rw-r--r--libs/host/CopyFile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index a822b41..8cdf07a 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/CopyFile.c
@@ -151,6 +151,12 @@ static int setPermissions(const char* dst, const struct stat* pSrcStat, unsigned
*/
ut.actime = pSrcStat->st_atime;
ut.modtime = pSrcStat->st_mtime;
+#ifdef MACOSX_RSRC
+ if (pSrcStat->st_mtimespec.tv_nsec > 0)
+#else
+ if (pSrcStat->st_mtim.tv_nsec > 0)
+#endif
+ ut.modtime += 1;
if (utime(dst, &ut) != 0) {
DBUG(("--- unable to set timestamps on '%s': %s\n",
dst, strerror(errno)));