Fix a problem where we were not calling fcntl() with the correct arguments for F_DUPFD
On Mac OS X, this was working just fine in debug builds (presumably, because the right value ended up being at the right location for the variadic ABI), but not in Release builds
As a result, we were seeing failures with commands that set their own immediate output stream - only in Release builds, which always makes for a fun little investigation
I have removed those fcntl() calls and replaced them with dup() calls. This fixes the issue in both Debug and Release builds
llvm-svn: 258367
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index a862f2c..99a87ac 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -191,7 +191,7 @@
#ifdef _WIN32
m_descriptor = ::_dup(GetDescriptor());
#else
- m_descriptor = ::fcntl(GetDescriptor(), F_DUPFD);
+ m_descriptor = dup(GetDescriptor());
#endif
m_should_close_fd = true;
}
@@ -237,7 +237,7 @@
#ifdef _WIN32
m_descriptor = ::_dup(rhs.GetDescriptor());
#else
- m_descriptor = ::fcntl(rhs.GetDescriptor(), F_DUPFD);
+ m_descriptor = dup(rhs.GetDescriptor());
#endif
if (!DescriptorIsValid())
error.SetErrorToErrno();