From d01087362e2f773c4c35b748f4ee0a8d4471308d Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 31 Jul 2023 10:58:06 +0200 Subject: [PATCH] libc: Set the close-on-exec flag for directories opened using opendir() This is apparently mandated by POSIX. --- libc/src/dirent.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc/src/dirent.cpp b/libc/src/dirent.cpp index c58256f9..1731fdca 100644 --- a/libc/src/dirent.cpp +++ b/libc/src/dirent.cpp @@ -20,6 +20,8 @@ extern "C" return nullptr; } + fcntl(fd, F_SETFD, FD_CLOEXEC); + dp->_fd = fd; return dp;