+2023-06-05 Bruno Haible <bruno@clisp.org>
+
+ Fix bugs on mingw when module dirfd is in use (regression 2023-04-26).
+ * lib/getcwd.c: When GNULIB_defined_DIR, revert to the system's
+ definitions of opendir, closedir, readdir, rewinddir.
+ * lib/mountlist.c: When GNULIB_defined_DIR, revert to the system's
+ definitions of opendir, closedir, readdir.
+ * lib/scandir.c: Likewise.
+ * lib/glob.c: Fix comment. When GNULIB_defined_DIR, don't undefine
+ opendir, closedir.
+
2023-06-04 Bruno Haible <bruno@clisp.org>
manywarnings: Overhaul documentation.
FIXME - if the kernel ever adds support for multi-thread safety for
avoiding standard fds, then we should use opendir_safer and
openat_safer. */
-#ifdef GNULIB_defined_opendir
+#ifdef GNULIB_defined_DIR
+# undef DIR
# undef opendir
-#endif
-#ifdef GNULIB_defined_closedir
# undef closedir
+# undef readdir
+# undef rewinddir
+#else
+# ifdef GNULIB_defined_opendir
+# undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+# undef closedir
+# endif
#endif
-\f
+
#if defined _WIN32 && !defined __CYGWIN__
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
static char *
#endif
#ifndef _LIBC
-/* The results of opendir() in this file are not used with dirfd and fchdir,
- and we do not leak fds to any single-threaded code that could use stdio,
- therefore save some unnecessary recursion in fchdir.c and opendir_safer.c.
- FIXME - if the kernel ever adds support for multi-thread safety for
- avoiding standard fds, then we should use opendir_safer. */
-# ifdef GNULIB_defined_opendir
-# undef opendir
-# endif
-# ifdef GNULIB_defined_closedir
-# undef closedir
+/* The results of opendir() in this file are used with dirfd. But they are
+ not used with fchdir, and we do not leak fds to any single-threaded code
+ that could use stdio, therefore save some unnecessary recursion in
+ fchdir.c and opendir_safer.c. */
+# ifndef GNULIB_defined_DIR
+# ifdef GNULIB_defined_opendir
+# undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+# undef closedir
+# endif
# endif
/* Just use malloc. */
/* The results of opendir() in this file are not used with dirfd and fchdir,
therefore save some unnecessary work in fchdir.c. */
-#ifdef GNULIB_defined_opendir
+#ifdef GNULIB_defined_DIR
+# undef DIR
# undef opendir
-#endif
-#ifdef GNULIB_defined_closedir
# undef closedir
+# undef readdir
+#else
+# ifdef GNULIB_defined_opendir
+# undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+# undef closedir
+# endif
#endif
#define ME_DUMMY_0(Fs_name, Fs_type) \
therefore save some unnecessary recursion in fchdir.c and opendir_safer.c.
FIXME - if the kernel ever adds support for multi-thread safety for
avoiding standard fds, then we should use opendir_safer. */
-# undef opendir
-# undef closedir
+# ifdef GNULIB_defined_DIR
+# undef DIR
+# undef opendir
+# undef closedir
+# undef readdir
+# else
+# ifdef GNULIB_defined_opendir
+# undef opendir
+# endif
+# ifdef GNULIB_defined_closedir
+# undef closedir
+# endif
+# endif
#endif
#ifndef SCANDIR_CANCEL