From 22f993fab6aaf2e77cac7ac9cc1bb3dcb35e8685 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 8 Dec 2025 01:10:14 +0300 Subject: [PATCH] libutil: Get rid of TODO comments for O_CLOEXEC By default windows doesn't allow inheriting handles anyway. These comments are just confusing at this point. --- src/libutil/file-system.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libutil/file-system.cc b/src/libutil/file-system.cc index 0ad6d9285..4851d8cfb 100644 --- a/src/libutil/file-system.cc +++ b/src/libutil/file-system.cc @@ -260,8 +260,7 @@ std::string readFile(const Path & path) AutoCloseFD fd = toDescriptor(open( path.c_str(), O_RDONLY -// TODO -#ifndef _WIN32 +#ifdef O_CLOEXEC | O_CLOEXEC #endif )); @@ -294,8 +293,7 @@ void readFile(const Path & path, Sink & sink, bool memory_map) AutoCloseFD fd = toDescriptor(open( path.c_str(), O_RDONLY -// TODO -#ifndef _WIN32 +#ifdef O_CLOEXEC | O_CLOEXEC #endif )); @@ -309,8 +307,7 @@ void writeFile(const Path & path, std::string_view s, mode_t mode, FsSync sync) AutoCloseFD fd = toDescriptor(open( path.c_str(), O_WRONLY | O_TRUNC | O_CREAT -// TODO -#ifndef _WIN32 +#ifdef O_CLOEXEC | O_CLOEXEC #endif , @@ -344,8 +341,7 @@ void writeFile(const Path & path, Source & source, mode_t mode, FsSync sync) AutoCloseFD fd = toDescriptor(open( path.c_str(), O_WRONLY | O_TRUNC | O_CREAT -// TODO -#ifndef _WIN32 +#ifdef O_CLOEXEC | O_CLOEXEC #endif ,