diff options
author | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-02 13:21:12 +0000 |
---|---|---|
committer | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-02 13:21:12 +0000 |
commit | ac399634ade737561bc96b767ee6fb9662f1e03c (patch) | |
tree | ff26f02f37d3432257309fd79fe7dcdd37755ff2 | |
parent | 3614e87632416402f1516e79b37ec092862fcec2 (diff) | |
download | libapr-ac399634ade737561bc96b767ee6fb9662f1e03c.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
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 13 |
2 files changed, 4 insertions, 11 deletions
@@ -258,6 +258,8 @@ Changes for APR 2.0.0 *) apr_proc_create(): Properly escape arguments containing whitespace characters on Windows [Ivan Zhakov] + *) apr_file_mtime_set(): Minor optimization on Windows. [Ivan Zhakov] + Changes for APR and APR-util 1.7.x 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 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); } |