From a67bc11058f47eeba1f8bb30173c73ec0af8fcce Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 5 Jul 2010 17:04:37 +0800 Subject: [PATCH 1/2] 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 --- libs/host/CopyFile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c index a822b412ff..8cdf07a57c 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))); From e3bc7aca02fe4d8f86431a3d28c8ff54c331da33 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Queru Date: Thu, 8 Jul 2010 10:15:03 -0700 Subject: [PATCH 2/2] Revert "acp: Ensure dst mtime always greater or equal to src mtime" This reverts commit a67bc11058f47eeba1f8bb30173c73ec0af8fcce. Change-Id: Iba646152e62d61f0e4e64541748e7821a7dd3a9c --- libs/host/CopyFile.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c index 8cdf07a57c..a822b412ff 100644 --- a/libs/host/CopyFile.c +++ b/libs/host/CopyFile.c @@ -151,12 +151,6 @@ 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)));