aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2020-10-02 13:38:09 +0200
committerPavel Labath <pavel@labath.sk>2020-10-07 15:29:29 +0200
commit3dfb94986170c57d9b3f5f2cba039a2eab5e6f13 (patch)
tree98ebd320ab4b812951f0ddc7574d2c99a17d1542 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parent029290f1a6231507b82981d56c0a0d2b02d508e0 (diff)
downloadllvm-3dfb94986170c57d9b3f5f2cba039a2eab5e6f13.zip
llvm-3dfb94986170c57d9b3f5f2cba039a2eab5e6f13.tar.gz
llvm-3dfb94986170c57d9b3f5f2cba039a2eab5e6f13.tar.bz2
[lldb] Check for and use ptsname_r if available
ptsname is not thread-safe. ptsname_r is available on most (but not all) systems -- use it preferentially. In the patch I also improve the thread-safety of the ptsname fallback path by wrapping it in a mutex. This should guarantee the safety of a typical ptsname implementation using a single static buffer, as long as all callers go through this function. I also remove the error arguments, as the only way this function can fail is if the "primary" fd is not valid. This is a programmer error as this requirement is documented, and all callers ensure that is the case. Differential Revision: https://reviews.llvm.org/D88728
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 8dea8b9..9adf25f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -818,7 +818,7 @@ Status ProcessGDBRemote::DoLaunch(lldb_private::Module *exe_module,
// does a lot of output.
if ((!stdin_file_spec || !stdout_file_spec || !stderr_file_spec) &&
pty.OpenFirstAvailablePrimary(O_RDWR | O_NOCTTY, nullptr, 0)) {
- FileSpec secondary_name{pty.GetSecondaryName(nullptr, 0)};
+ FileSpec secondary_name(pty.GetSecondaryName());
if (!stdin_file_spec)
stdin_file_spec = secondary_name;