[Lldb-commits] [lldb] r205740 - Fixed a case where we could spin indefinitely if we got an error from fgets that isn't EINTR.

Greg Clayton gclayton at apple.com
Mon Apr 7 14:37:59 PDT 2014


Author: gclayton
Date: Mon Apr  7 16:37:59 2014
New Revision: 205740

URL: http://llvm.org/viewvc/llvm-project?rev=205740&view=rev
Log:
Fixed a case where we could spin indefinitely if we got an error from fgets that isn't EINTR.

<rdar://problem/16535437>


Modified:
    lldb/trunk/source/Core/IOHandler.cpp

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=205740&r1=205739&r2=205740&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Mon Apr  7 16:37:59 2014
@@ -410,8 +410,14 @@ IOHandlerEditline::GetLine (std::string
             {
                 if (fgets(buffer, sizeof(buffer), in) == NULL)
                 {
+                    const int saved_errno = errno;
                     if (feof(in))
                         done = true;
+                    else if (ferror(in))
+                    {
+                        if (saved_errno != EINTR)
+                            done = true;
+                    }
                 }
                 else
                 {





More information about the lldb-commits mailing list