summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Utility')
-rw-r--r--lldb/source/Utility/PseudoTerminal.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/source/Utility/PseudoTerminal.cpp b/lldb/source/Utility/PseudoTerminal.cpp
index e90955d37d4..55d4a9a1fc1 100644
--- a/lldb/source/Utility/PseudoTerminal.cpp
+++ b/lldb/source/Utility/PseudoTerminal.cpp
@@ -239,7 +239,7 @@ PseudoTerminal::Fork (char *error_str, size_t error_len)
error_str[0] = '\0';
pid_t pid = LLDB_INVALID_PROCESS_ID;
- if (OpenFirstAvailableMaster (O_RDWR, error_str, error_len))
+ if (OpenFirstAvailableMaster (O_RDWR | O_CLOEXEC, error_str, error_len))
{
// Successfully opened our master pseudo terminal
@@ -258,7 +258,8 @@ PseudoTerminal::Fork (char *error_str, size_t error_len)
if (OpenSlave (O_RDWR, error_str, error_len))
{
// Successfully opened slave
- // We are done with the master in the child process so lets close it
+
+ // Master FD should have O_CLOEXEC set, but let's close it just in case...
CloseMasterFileDescriptor ();
#if defined(TIOCSCTTY)
OpenPOWER on IntegriCloud