diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-09-12 17:25:52 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-09-12 17:25:52 +0000 |
commit | 21c8cfb55bc0f865f13df38afb96a6056260cca8 (patch) | |
tree | c86870feb322e738a7ca3746e1b52dadbe2fe9f9 | |
parent | 97db6dcbe7aee0b1a3e1d5c0758bd2c847e9248e (diff) | |
download | apr-21c8cfb55bc0f865f13df38afb96a6056260cca8.tar.gz |
On 1.7.x: Merge r1902043 from 1.8.x branch:
Fix a regression in apr_stat() for root path on Windows
caused by the extended symlink detection added in r1855949 (PR47630).
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1904030 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 15 |
2 files changed, 8 insertions, 9 deletions
@@ -75,6 +75,8 @@ Changes for APR 1.7.1 *) Fix double free on exit when apr_app is used on Windows. [Ivan Zhakov] + *) Fix a regression in apr_stat() for root path on Windows. [Ivan Zhakov] + Changes for APR 1.7.0 *) apr_dir_read: [Unix] Dropped the preference of the dirread_r() flavor diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index c90b9abc0..5ddee7f29 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -624,7 +624,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, if ((rv = utf8_to_unicode_path(wfname, sizeof(wfname) / sizeof(apr_wchar_t), fname))) return rv; - if (!(wanted & (APR_FINFO_NAME | APR_FINFO_LINK))) { + if (!(wanted & APR_FINFO_NAME)) { if (!GetFileAttributesExW(wfname, GetFileExInfoStandard, &FileInfo.i)) return apr_get_os_error(); @@ -634,6 +634,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, * since we want the true name, and set aside a long * enough string to handle the longest file name. */ + char tmpname[APR_FILE_MAX * 3 + 1]; HANDLE hFind; if ((rv = test_safe_name(fname)) != APR_SUCCESS) { return rv; @@ -644,15 +645,11 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, FindClose(hFind); finddata = 1; - if (wanted & APR_FINFO_NAME) - { - char tmpname[APR_FILE_MAX * 3 + 1]; - if (unicode_to_utf8_path(tmpname, sizeof(tmpname), - FileInfo.w.cFileName)) { - return APR_ENAMETOOLONG; - } - filename = apr_pstrdup(pool, tmpname); + if (unicode_to_utf8_path(tmpname, sizeof(tmpname), + FileInfo.w.cFileName)) { + return APR_ENAMETOOLONG; } + filename = apr_pstrdup(pool, tmpname); } } #endif |