summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-06-18 13:36:42 +0000
committerIvan Zhakov <ivan@apache.org>2022-06-18 13:36:42 +0000
commit234757a0fb715bf31a729f6a3099c4c8a915e48f (patch)
tree33bf0d20e3a13a4c679240d6f9035738fb53e0d4
parenta8d5d20a99e73a1dc9b552d0901718d7f70ea216 (diff)
downloadapr-234757a0fb715bf31a729f6a3099c4c8a915e48f.tar.gz
On 1.8.x branch: Merge r1896623 from trunk:
Optimize apr_file_mtime_set() on Windows. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x@1902044 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES2
-rw-r--r--file_io/win32/filestat.c13
2 files changed, 4 insertions, 11 deletions
diff --git a/CHANGES b/CHANGES
index eb67fd5a9..98f36c146 100644
--- a/CHANGES
+++ b/CHANGES
@@ -74,6 +74,8 @@ Changes for APR 1.7.1
*) Fixed: apr_get_oslevel() was returning APR_WIN_XP on Windows 10
+ *) apr_file_mtime_set(): Minor optimization on Windows. [Ivan Zhakov]
+
Changes for APR 1.7.0 and later:
*) http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/CHANGES?view=markup
diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c
index 5ddee7f29..17f271888 100644
--- a/file_io/win32/filestat.c
+++ b/file_io/win32/filestat.c
@@ -877,20 +877,11 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
APR_OS_DEFAULT, pool);
if (!rv)
{
- FILETIME file_ctime;
- FILETIME file_atime;
FILETIME file_mtime;
- if (!GetFileTime(thefile->filehand,
- &file_ctime, &file_atime, &file_mtime))
+ AprTimeToFileTime(&file_mtime, mtime);
+ if (!SetFileTime(thefile->filehand, NULL, NULL, &file_mtime))
rv = apr_get_os_error();
- else
- {
- AprTimeToFileTime(&file_mtime, mtime);
- if (!SetFileTime(thefile->filehand,
- &file_ctime, &file_atime, &file_mtime))
- rv = apr_get_os_error();
- }
apr_file_close(thefile);
}