[Bug #21128] Include fcntl.h before checking for O_CLOEXEC

On glibc O_CLOEXEC is defined in fcntl.h and not unistd.h so this change
prevents the macro from being redefined.
This commit is contained in:
Collin Funk 2025-02-11 21:07:40 -08:00 committed by Nobuyoshi Nakada
parent c8f4df4ae9
commit c1c7934b63
Notes: git 2025-02-17 04:05:35 +00:00

12
dir.c
View File

@ -22,10 +22,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif
#ifndef USE_OPENDIR_AT #ifndef USE_OPENDIR_AT
# if defined(HAVE_FDOPENDIR) && defined(HAVE_DIRFD) && \ # if defined(HAVE_FDOPENDIR) && defined(HAVE_DIRFD) && \
defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) defined(HAVE_OPENAT) && defined(HAVE_FSTATAT)
@ -35,8 +31,12 @@
# endif # endif
#endif #endif
#if USE_OPENDIR_AT #ifdef HAVE_FCNTL_H
# include <fcntl.h> # include <fcntl.h>
#endif
#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif #endif
#undef HAVE_DIRENT_NAMLEN #undef HAVE_DIRENT_NAMLEN