summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-06-16 17:56:15 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-06-16 17:56:15 +0000
commitf15cb60a3e689fb546f90b47ea0644c20c7b2cc2 (patch)
tree9fd39d64453f4e4263137aa37a002cec599f2690
parent1fbcb9fa7c614f2fa1647e3c37c9db3519f62b83 (diff)
downloadlibapr-f15cb60a3e689fb546f90b47ea0644c20c7b2cc2.tar.gz
On 1.8.x-r1896717 branch: Backport r1896717:
Fix a regression in apr_stat() for root path on Windows caused by the extended symlink detection added in r1855949 (PR47630) [1]. See [2] for the detailed problem report and discussion. [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=47630 [2] https://lists.apache.org/thread/18x2jb81nf6zrjsnwf1k2wwooprkp0p5 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.8.x-r1896717@1901988 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--file_io/win32/filestat.c15
1 files changed, 6 insertions, 9 deletions
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