Fix bug where an additional O packet is sent after inferior exits.
authorChaoren Lin <chaorenl@google.com>
Tue, 7 Apr 2015 18:45:03 +0000 (18:45 +0000)
committerChaoren Lin <chaorenl@google.com>
Tue, 7 Apr 2015 18:45:03 +0000 (18:45 +0000)
Summary:
ConnectionFileDescriptor::Read was returning eConnectionStatusError instead of 0
on m_shutting_down, which caused the caller to think that some number of bytes
were read.

Reviewers: jingham, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D8850

llvm-svn: 234341

lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp

index 19ee0fe..9946cb4 100644 (file)
@@ -386,8 +386,12 @@ ConnectionFileDescriptor::Read(void *dst, size_t dst_len, uint32_t timeout_usec,
         status = eConnectionStatusTimedOut;
         return 0;
     }
-    else if (m_shutting_down)
-        return eConnectionStatusError;
+
+    if (m_shutting_down)
+    {
+        status = eConnectionStatusError;
+        return 0;
+    }
 
     status = BytesAvailable(timeout_usec, error_ptr);
     if (status != eConnectionStatusSuccess)