[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

10
dir.c
View File

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