bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lib/dirfd.c: compiler warning: unused parameter


From: Bruno Haible
Subject: Re: lib/dirfd.c: compiler warning: unused parameter
Date: Fri, 05 May 2023 12:13:09 +0200

Bjarni Ingi Gislason wrote:
>     HAVE_DIRFD=1
>     dnl Replace only if the system declares dirfd already.
>     if test $ac_cv_have_decl_dirfd = yes; then
> ->      REPLACE_DIRFD=0 /* FIX ME, was =1 */
>     fi

Oh, indeed, there's a mistake here. I thought that it was OK
to compile lib/dirfd.c because <dirent.h> defines DIR, and
DIR is expected to have a d_fd or dd_fd member. But glibc
defines DIR in an opaque way. The d_fd or dd_fd member is
meant only as a fallback for systems that don't have the
dirfd function or macro.

It was my mistake on 2023-04-26. I would have noticed the
mistake if there had been a unit test for the 'dirfd' module.
So, let me add a unit test now.


2023-05-05  Bruno Haible  <bruno@clisp.org>

        dirfd: Add tests.
        * tests/test-dirfd.c: New file.
        * modules/dirfd-tests: New file.

2023-05-05  Bruno Haible  <bruno@clisp.org>

        dirfd: Fix bogus override (regression 2023-04-26).
        Reported by Bjarni Ingi Gislason <bjarniig@simnet.is> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00040.html>.
        * m4/dirfd.m4 (gl_FUNC_DIRFD): Fix mistake in last change.

Attachment: 0001-dirfd-Fix-bogus-override-regression-2023-04-26.patch
Description: Text Data

Attachment: 0002-dirfd-Add-tests.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]