Skip to content

Commit c1c7934

Browse files
collinfunknobu
authored andcommitted
[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.
1 parent c8f4df4 commit c1c7934

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

dir.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include <unistd.h>
2323
#endif
2424

25-
#ifndef O_CLOEXEC
26-
# define O_CLOEXEC 0
27-
#endif
28-
2925
#ifndef USE_OPENDIR_AT
3026
# if defined(HAVE_FDOPENDIR) && defined(HAVE_DIRFD) && \
3127
defined(HAVE_OPENAT) && defined(HAVE_FSTATAT)
@@ -35,8 +31,12 @@
3531
# endif
3632
#endif
3733

38-
#if USE_OPENDIR_AT
39-
# include <fcntl.h>
34+
#ifdef HAVE_FCNTL_H
35+
# include <fcntl.h>
36+
#endif
37+
38+
#ifndef O_CLOEXEC
39+
# define O_CLOEXEC 0
4040
#endif
4141

4242
#undef HAVE_DIRENT_NAMLEN

0 commit comments

Comments
 (0)