This makes the dirent functions usable in applications that have been marked as long path aware in their application manifests. --- mingw-w64-crt/misc/dirent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c index b1195fa44..f58e44b7f 100644 --- a/mingw-w64-crt/misc/dirent.c +++ b/mingw-w64-crt/misc/dirent.c @@ -41,7 +41,6 @@ _topendir (const _TCHAR *szPath) { _TDIR *nd; unsigned int rc; - wchar_t bufferForFullPath[MAX_PATH]; wchar_t *fullPath; if (!szPath) @@ -73,7 +72,7 @@ _topendir (const _TCHAR *szPath) /* Make an absolute pathname. */ #ifdef _UNICODE - fullPath = _wfullpath (bufferForFullPath, szPath, MAX_PATH); + fullPath = _wfullpath (NULL, szPath, 0); #else { /* Convert szPath to wide char. */ @@ -101,7 +100,7 @@ _topendir (const _TCHAR *szPath) return NULL; } - fullPath = _wfullpath (bufferForFullPath, wzPath, MAX_PATH); + fullPath = _wfullpath (NULL, wzPath, 0); /* If _wfullpath failed, we need its errno value. */ int savedErrno = errno; @@ -128,12 +127,14 @@ _topendir (const _TCHAR *szPath) if (!nd) { /* Error, out of memory. */ + free (fullPath); errno = ENOMEM; return NULL; } /* Create the search expression. */ memcpy (nd->dd_name, fullPath, (fullPathLen + 1) * sizeof (wchar_t)); + free (fullPath); /* Add on a slash if the path does not end with one. */ if (fullPathLen > 0 && -- 2.47.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public