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.

llvm-svn: 220705
This commit is contained in:
Hafiz Abid Qadeer 2014-10-27 19:27:00 +00:00
parent eae91040d8
commit f289628178
1 changed files with 4 additions and 0 deletions

View File

@ -66,7 +66,11 @@ PseudoTerminal::CloseMasterFileDescriptor ()
{
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;
}
}