Hi/2.
Bruno Haible wrote:
> KO Myung-Hun wrote:
>>> dirfd is specified at
>>> https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html
>>> Which says that if "The dirp argument does not refer to a valid directory
>>> stream"
>>> the function may fail with error EINVAL. It may alterna
KO Myung-Hun wrote:
> > dirfd is specified at
> > https://pubs.opengroup.org/onlinepubs/9699919799/functions/dirfd.html
> > Which says that if "The dirp argument does not refer to a valid directory
> > stream"
> > the function may fail with error EINVAL. It may alternatively simply crash
> > ("the
Bruno Haible wrote:
> KO Myung-Hun wrote:
>>> @@ -78,11 +82,17 @@ _gl_unregister_dirp_fd (int fd)
>>> int
>>> dirfd (DIR *dir_p)
>>> {
>>> +#if GNULIB_defined_DIR
>>> + int fd = dir_p->fd_to_close;
>>
>> dirfd() allows to take an invalid `dir_p' ?
>
> No; this must be a misunderstanding.
>
KO Myung-Hun wrote:
> > @@ -78,11 +82,17 @@ _gl_unregister_dirp_fd (int fd)
> > int
> > dirfd (DIR *dir_p)
> > {
> > +#if GNULIB_defined_DIR
> > + int fd = dir_p->fd_to_close;
>
> dirfd() allows to take an invalid `dir_p' ?
No; this must be a misunderstanding.
dirfd is specified at
https://p
Hi/2.
Bruno Haible wrote:
> On native Windows, I see a test failure:
>
> FAIL: test-fdopendir
>
>
> ../../gltests/test-fdopendir.c:76: assertion 'dup2 (fd, fd) == -1' failed
> FAIL test-fdopendir.exe (exit status: 3)
>
> The cause of the problem is that POSIX [1] says:
>
nlinepubs/9699919799/functions/fdopendir.html
2023-04-26 Bruno Haible
fdopendir: Fix fd leak and test failure on native Windows.
--
* lib/dirent-private.h: On mingw, define 'struct gl_directory' as a
wrapper around the original DIR. On MSVC, add