summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-01-27 21:52:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-01-28 11:12:17 +0100
commitd9261ef1345dcf4ff9096c66339a79a34979b8d8 (patch)
treecf99b2493c5811103341d07b32f680c54e5d9cc7 /sal/osl
parent41c8e0957369b7b53a3b9cf4b4cf1e49a982a414 (diff)
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.meeks@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/unx/file.cxx3
1 files changed, 3 insertions, 0 deletions
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)