---
 mingw-w64-crt/misc/dirent.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-crt/misc/dirent.c b/mingw-w64-crt/misc/dirent.c
index 4f9c61b0c..20266966a 100644
--- a/mingw-w64-crt/misc/dirent.c
+++ b/mingw-w64-crt/misc/dirent.c
@@ -73,7 +73,13 @@ _topendir (const _TCHAR *szPath)
     }
 
   /* Make an absolute pathname.  */
-  _tfullpath (szFullPath, szPath, MAX_PATH);
+  if (_tfullpath (szFullPath, szPath, MAX_PATH) == NULL)
+    {
+      /* It was a directory when GetFileAttributes was called but
+       * the absolute pathname could not be created now. Use the
+       * errno value set by _tfullpath. */
+      return NULL;
+    }
 
   /* Allocate enough space to store DIR structure and the complete
    * directory path given. */
-- 
2.47.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to