MINGW-packages/mingw-w64-python/0080-posixmodule-undefine-HAVE_OPENDIR.patch
2025-06-07 14:11:54 +02:00

32 lines
1.3 KiB
Diff

From 9d6027c1cdd7ee18a306fd4d604dcc6e005942fd Mon Sep 17 00:00:00 2001
From: Naveen M K <naveen521kk@gmail.com>
Date: Tue, 20 Jun 2023 18:32:58 +0530
Subject: [PATCH 080/N] posixmodule: undefine `HAVE_OPENDIR`
opendir is detected by configure on mingw-w64, and for some reason
things don't work as expected. For example, os.listdir always returns
the cwd's directory listing instead of the one specified. By
un-defining, this, os.listdir will use the one which uses native
windows API.
---
Modules/posixmodule.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index b326a14..53b93d2 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -373,6 +373,12 @@ corresponding Unix manual entries for more information on calls.");
#elif defined(__MINGW32__) /* GCC for windows hosts */
/* getlogin is detected by configure on mingw-w64 */
# undef HAVE_GETLOGIN
+/* opendir is detected by configure on mingw-w64, and for some reason
+things don't work as expected. For example, os.listdir always returns
+the cwd's directory listing instead of the one specified. By
+un-defining, this, os.listdir will use the one which uses native
+windows API. */
+# undef HAVE_OPENDIR
/*# define HAVE_GETCWD 1 - detected by configure*/
# define HAVE_GETPPID 1
# define HAVE_GETLOGIN 1