summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-01-02 13:21:12 +0000
committerIvan Zhakov <ivan@apache.org>2022-01-02 13:21:12 +0000
commit136ab9c97fc56b69cb0429a9ab7920df3e4fc603 (patch)
treeff26f02f37d3432257309fd79fe7dcdd37755ff2 /file_io
parentffdb44a5e802befeeeeb928ed1fb76037a1c22b6 (diff)
downloadapr-136ab9c97fc56b69cb0429a9ab7920df3e4fc603.tar.gz
Optimize apr_file_mtime_set() on Windows.
* file_io/win32/filestat.c (apr_file_mtime_set): Pass NULL as ATIME and CTIME when calling SetFileTime() to prevent changing ATIME and CTIME instead of retrieving these times using GetFileTime(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896623 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/filestat.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c
index ce32cf91d..0138341dc 100644
--- a/file_io/win32/filestat.c
+++ b/file_io/win32/filestat.c
@@ -752,20 +752,11 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
APR_FPROT_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);
}