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

New commits:
commit d9261ef1345dcf4ff9096c66339a79a34979b8d8
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jan 27 21:52:09 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jan 28 11:12:17 2024 +0100

    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
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162647
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Jenkins

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index eeee7c803fd8..5acfe2803189 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -988,6 +988,9 @@ oslFileError openFilePath(const OString& filePath, 
oslFileHandle* pHandle,
     if (flags & O_EXCL && !(flags & O_CREAT))
         flags &= ~O_EXCL;
 
+    // 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