summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/StreamFile.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-02-05 16:44:42 +0000
committerPavel Labath <labath@google.com>2015-02-05 16:44:42 +0000
commit97a9ac198255de8420624d66417301765b116795 (patch)
tree02d208dd514abfd962acf305c0205aceec69898a /lldb/source/Core/StreamFile.cpp
parentfe0c7ad852497889fcadd7a814d551aa9af5ccf5 (diff)
downloadbcm5719-llvm-97a9ac198255de8420624d66417301765b116795.tar.gz
bcm5719-llvm-97a9ac198255de8420624d66417301765b116795.zip
Avoid leaking log file descriptors into the inferior process.
Summary: This commit adds a new open flag File::eOpenOptionCloseOnExec (i.e., O_CLOEXEC), and adds it to the list of flags when opening log files (#ifndef windows). A regression test is included. Reviewers: vharron, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7412 llvm-svn: 228310
Diffstat (limited to 'lldb/source/Core/StreamFile.cpp')
-rw-r--r--lldb/source/Core/StreamFile.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp
index 2285ca95445..9f8dd629e3d 100644
--- a/lldb/source/Core/StreamFile.cpp
+++ b/lldb/source/Core/StreamFile.cpp
@@ -49,7 +49,8 @@ StreamFile::StreamFile (FILE *fh, bool transfer_ownership) :
StreamFile::StreamFile (const char *path) :
Stream (),
- m_file (path, File::eOpenOptionWrite | File::eOpenOptionCanCreate, lldb::eFilePermissionsFileDefault)
+ m_file (path, File::eOpenOptionWrite | File::eOpenOptionCanCreate | File::eOpenOptionCloseOnExec,
+ lldb::eFilePermissionsFileDefault)
{
}
OpenPOWER on IntegriCloud