]> Savannah Git Hosting - gnulib.git/commitdiff
Fix bugs on mingw when module dirfd is in use (regression 2023-04-26).
authorBruno Haible <bruno@clisp.org>
Mon, 5 Jun 2023 09:15:37 +0000 (11:15 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 5 Jun 2023 09:15:37 +0000 (11:15 +0200)
* 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.

ChangeLog
lib/getcwd.c
lib/glob.c
lib/mountlist.c
lib/scandir.c

index 9a30a0fb8a13c9f67e901a85ee662f094b051b69..9554071224a7ed88668a2dc66ae7f1addd334f38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
index 0530630c43f654a879ca04df281ae45490124e01..28f69133a847b5930e6636c0fd300ef70cfb58a3 100644 (file)
    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 *
index ddca1e98207b217786c7d37cfbec92311e877895..af0694eec4e5248849ba5aa9d2df829c67231f77 100644 (file)
@@ -182,16 +182,17 @@ convert_dirent64 (const struct dirent64 *source)
 #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.  */
index 6d3848128401c6bad11cf1d4e5b923c92cf8f27e..8b06e7b7ee9e0cf101d64e716084c39669f80ae1 100644 (file)
 
 /* 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)            \
index 9d582e7ac3be02e754614563efd82280e991b199..429067ed74ae7309d6061a8af144dd5be52fc11b 100644 (file)
    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