Paul Eggert <egg...@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)