summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVince Harron <vince@nethacker.com>2015-04-20 18:15:33 +0000
committerVince Harron <vince@nethacker.com>2015-04-20 18:15:33 +0000
commitb9bd6af2f2ffcbd44658a083f6a4096b39a27ca5 (patch)
tree02819e5cf5f286c7e47fc7dd6c739256f6d40529
parent207d248eba51c25dfca8dc3b1a38703e07fb7b2b (diff)
downloadbcm5719-llvm-b9bd6af2f2ffcbd44658a083f6a4096b39a27ca5.tar.gz
bcm5719-llvm-b9bd6af2f2ffcbd44658a083f6a4096b39a27ca5.zip
ConnectionFileDescriptor::BytesAvailable reading too many command bytes
ConnectionFileDescriptor::BytesAvailable was reading multiple command bytes from the command pipe but only processing the first. This change only allows one byte to be read at a time, ensuring that all get handled. This isn't known to cause any bugs, but it might cause current/future bugs. Differential Revision: http://reviews.llvm.org/D9098 llvm-svn: 235322
-rw-r--r--lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 9946cb42663..8eb848c9481 100644
--- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -685,8 +685,10 @@ ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, Error *error_ptr
return eConnectionStatusSuccess;
if (have_pipe_fd && FD_ISSET(pipe_fd, FD_SET_DATA(read_fds)))
{
- // We got a command to exit. Read the data from that pipe:
- char buffer[16];
+ // There is an interrupt or exit command in the command pipe
+ // Read the data from that pipe:
+ char buffer[1];
+
ssize_t bytes_read;
do
@@ -698,8 +700,9 @@ ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, Error *error_ptr
{
case 'q':
if (log)
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.",
- static_cast<void *>(this), static_cast<int>(bytes_read), buffer);
+ log->Printf("%p ConnectionFileDescriptor::BytesAvailable() "
+ "got data: %c from the command channel.",
+ static_cast<void *>(this), buffer[0]);
return eConnectionStatusEndOfFile;
case 'i':
// Interrupt the current read
OpenPOWER on IntegriCloud