From cee597a728c89c0d7217a646aea84b14b534e200 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Fri, 17 Jan 2020 21:51:23 +0300 Subject: [PATCH] LibCore: Make CIODevice::read_all() actually read all data It used to only read the data it could get without blocking. Andreas says this was intentional, but it's counterintuitive and no code that uses read_all() actually expects it to return only a part of the data. So change it to always read data until an EOF (or an error) is received. --- Libraries/LibCore/CIODevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibCore/CIODevice.cpp b/Libraries/LibCore/CIODevice.cpp index b0f6148563..ea526c148d 100644 --- a/Libraries/LibCore/CIODevice.cpp +++ b/Libraries/LibCore/CIODevice.cpp @@ -124,7 +124,7 @@ ByteBuffer CIODevice::read_all() m_buffered_data.clear(); } - while (can_read_from_fd()) { + while (true) { char read_buffer[4096]; int nread = ::read(m_fd, read_buffer, sizeof(read_buffer)); if (nread < 0) {