[Lldb-commits] [lldb] r220705 - Stub out 'close' call on m_master_fd for Windows.

Hafiz Abid Qadeer hafiz_abid at mentor.com
Mon Oct 27 12:27:01 PDT 2014


Author: abidh
Date: Mon Oct 27 14:27:00 2014
New Revision: 220705

URL: http://llvm.org/viewvc/llvm-project?rev=220705&view=rev
Log:
Stub out 'close' call on m_master_fd for Windows.

PseudoTerminal.cpp uses a dummy implementation of posix_openpt for Windows. This
implementation just returns 0. So m_master_fd is 0. But destructor calls 'close'
on m_master_fd. This 'close' calls seems un-necessary as m_master_fd was never
opened in first place and calling 'close' on 0 can have other un-intended 
consequences.

I am committing it as obvious as it is only a one-liner. Long term, we may want
to refactor this class.


Modified:
    lldb/trunk/source/Utility/PseudoTerminal.cpp

Modified: lldb/trunk/source/Utility/PseudoTerminal.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/PseudoTerminal.cpp?rev=220705&r1=220704&r2=220705&view=diff
==============================================================================
--- lldb/trunk/source/Utility/PseudoTerminal.cpp (original)
+++ lldb/trunk/source/Utility/PseudoTerminal.cpp Mon Oct 27 14:27:00 2014
@@ -66,7 +66,11 @@ PseudoTerminal::CloseMasterFileDescripto
 {
     if (m_master_fd >= 0)
     {
+    // Don't call 'close' on m_master_fd for Windows as a dummy implementation of
+    // posix_openpt above always gives it a 0 value.
+#ifndef _WIN32
         ::close (m_master_fd);
+#endif
         m_master_fd = invalid_fd;
     }
 }





More information about the lldb-commits mailing list