[Top][All Lists]

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

Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir

From: DJ Delorie
Subject: Re: [patch v2] glob: resolve DT_UNKNOWN via is_dir
Date: Fri, 25 Mar 2022 15:18:59 -0400

Paul Eggert <eggert@cs.ucla.edu> writes:
>>> +# define dirfd(str) __dirfd (str)
>> This needs an #undef before it, else it causes build errors as glibc
>> already has a definition for dirfd() and it conflicts with this one.
>> Prudence says they should *all* be protected as such, but I only mention
>> the new one.
> Thanks, I protected it with an ifdef instead as that's more likely 
> perform better.

The use in glob.c conflicts with the definition in glibc, so #undef is
needed, not #ifndef.  glibc has:

  /* This is the data type of directory stream objects.
     The actual structure is opaque to users.  */
  typedef struct __dirstream DIR;
  extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));

What works in a glibc build is this:

  # undef dirfd
  # define dirfd(str) __dirfd (str)

reply via email to

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