diff options
author | Pavel Labath <labath@google.com> | 2015-02-05 16:44:42 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2015-02-05 16:44:42 +0000 |
commit | 97a9ac198255de8420624d66417301765b116795 (patch) | |
tree | 02d208dd514abfd962acf305c0205aceec69898a /lldb/source/Host/common/File.cpp | |
parent | fe0c7ad852497889fcadd7a814d551aa9af5ccf5 (diff) | |
download | bcm5719-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/Host/common/File.cpp')
-rw-r--r-- | lldb/source/Host/common/File.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 8568d8f1041..946f3dd6fef 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -288,6 +288,8 @@ File::Open (const char *path, uint32_t options, uint32_t permissions) #ifndef _WIN32 if (options & eOpenOptionNonBlocking) oflag |= O_NONBLOCK; + if (options & eOpenOptionCloseOnExec) + oflag |= O_CLOEXEC; #else oflag |= O_BINARY; #endif |