sal/osl/unx/file.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit e31d85d948838d93f8c04a8b91f507a4e31f5a3e
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jan 27 21:52:09 2024 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Sat Jan 27 20:41:01 2024 +0000

    cool#8016 open files using O_CLOEXEC
    
    which is useful to speed up exec'ing/spawning subprograms, and
    avoids various leakage issues.
    
    Change-Id: Ie06ceb6b377e9d5cca8c017c5666564f6bed482f

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 41ce0aae9aba..213dc6ab53de 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1139,6 +1139,9 @@ oslFileError openFilePath(const OString& filePath, 
oslFileHandle* pHandle,
     if (isForbidden( filePath, uFlags ))
         return osl_File_E_ACCES;
 
+    // set close-on-exec by default
+    flags |= O_CLOEXEC;
+
     /* open the file */
     int fd = open_c( filePath, flags, mode );
     if (fd == -1)

Reply via email to