From: Paul Eggert Date: Tue, 26 Apr 2022 21:54:26 +0000 (-0700) Subject: glob: port to NetBSD 9.2 X-Git-Tag: v1.0~2309 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=34a93be8aa8a15f5959a1b671ad1285a5d552f4b;p=gnulib.git glob: port to NetBSD 9.2 Problem reported by Benno Schulenberg in: https://lists.gnu.org/r/bug-gnulib/2022-04/msg00052.html * doc/posix-functions/dirfd.texi: Document NetBSD 9.2 portability bugs. Remove an old common about errno that is no longer true of POSIX 2018. * lib/glob.c (glob_in_dir): Convert dirfd arg from void * to DIR * before passing it to dirfd. --- diff --git a/ChangeLog b/ChangeLog index ddd4826bcf..cccb04696d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2022-04-26 Paul Eggert + + glob: port to NetBSD 9.2 + Problem reported by Benno Schulenberg in: + https://lists.gnu.org/r/bug-gnulib/2022-04/msg00052.html + * doc/posix-functions/dirfd.texi: Document NetBSD 9.2 portability + bugs. Remove an old common about errno that is no longer true + of POSIX 2018. + * lib/glob.c (glob_in_dir): Convert dirfd arg from void * + to DIR * before passing it to dirfd. + 2022-04-21 Paul Eggert regex: match [...---...] like V7 grep diff --git a/doc/posix-functions/dirfd.texi b/doc/posix-functions/dirfd.texi index 46ad5fe7d4..d0f6c8cdcd 100644 --- a/doc/posix-functions/dirfd.texi +++ b/doc/posix-functions/dirfd.texi @@ -18,8 +18,9 @@ Portability problems not fixed by Gnulib: @item This function always fails on some platforms: mingw. -@end itemize -With the @code{dirfd} module, this functions always sets @code{errno} when it -fails. (POSIX does not require that @code{dirfd} sets @code{errno} when it -fails.) +@item +There is a @code{dirfd} macro but no function, and the macro does not +work with an argument of type @code{void *}, as a function would: +NetBSD 9.2. +@end itemize diff --git a/lib/glob.c b/lib/glob.c index f6993a3706..57cb3bd1d1 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -1357,7 +1357,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags, } else { - int dfd = dirfd (stream); + DIR *dirp = stream; + int dfd = dirfd (dirp); int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)); flags |= GLOB_MAGCHAR;