[libc-commits] [libc] [libc] Add 'x' and 'e' mode support to fopen() (PR #224207)
Jeong Jihyeon via libc-commits
libc-commits at lists.llvm.org
Thu Sep 17 08:06:00 PDT 2026
================
@@ -215,7 +237,10 @@ int LinuxFile::reopen_unlocked(const char *path, const char *mode) {
// Else the new file successfully opened, so we move it into the fd the old
// file was using if the old fd exists.
if (old_fd >= 0) {
- auto dup_result = linux_syscalls::dup2(new_fd.value(), old_fd);
+ // Preserve close-on-exec atomically when replacing the old descriptor.
----------------
JihyeonJeong129 wrote:
Thanks for the review! I've updated the code as suggested.
Please let me know if any further changes are needed.
https://github.com/llvm/llvm-project/pull/224207
More information about the libc-commits
mailing list