From c1c7934b63d7682216fed9dd7c9ddff5b72fea89 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Tue, 11 Feb 2025 21:07:40 -0800 Subject: [PATCH] [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. --- dir.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dir.c b/dir.c index b0ff322886..b934f2795c 100644 --- a/dir.c +++ b/dir.c @@ -22,10 +22,6 @@ #include #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,8 +31,12 @@ # endif #endif -#if USE_OPENDIR_AT -# include +#ifdef HAVE_FCNTL_H +# include +#endif + +#ifndef O_CLOEXEC +# define O_CLOEXEC 0 #endif #undef HAVE_DIRENT_NAMLEN