summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-09-12 17:25:52 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-09-12 17:25:52 +0000
commitdaf8bd7447ea0d87fa1a9827129033cfb5e9a862 (patch)
treec86870feb322e738a7ca3746e1b52dadbe2fe9f9
parent57301f57d4f63a043e606531e82a71eb5074f983 (diff)
downloadlibapr-daf8bd7447ea0d87fa1a9827129033cfb5e9a862.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--CHANGES2
-rw-r--r--file_io/win32/filestat.c15
2 files changed, 8 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index dc414894e..fd1e749bd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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