diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp --- a/lldb/source/Core/IOHandler.cpp +++ b/lldb/source/Core/IOHandler.cpp @@ -384,7 +384,7 @@ if (!got_line && !in && m_input_sp) { // there is no FILE*, fall back on just reading bytes from the stream. - while (!got_line) { + do { size_t bytes_read = sizeof(buffer); Status error = m_input_sp->Read((void *)buffer, bytes_read); if (error.Success() && !bytes_read) { @@ -395,12 +395,12 @@ break; m_line_buffer += StringRef(buffer, bytes_read); got_line = SplitLine(m_line_buffer); - } + } while (!got_line); } if (!got_line && in) { m_editing = true; - while (!got_line) { + do { char *r = fgets(buffer, sizeof(buffer), in); #ifdef _WIN32 // ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED @@ -424,7 +424,7 @@ } m_line_buffer += buffer; got_line = SplitLine(m_line_buffer); - } + } while (!got_line); m_editing = false; } @@ -432,9 +432,10 @@ line = got_line.getValue(); if (m_data_recorder) m_data_recorder->Record(line, true); + return true; } - return (bool)got_line; + return false; } #if LLDB_ENABLE_LIBEDIT