diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-05-10 18:20:54 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-05-10 18:20:54 +0200 |
commit | dbf7878998dca49012716370f412f446d9926310 (patch) | |
tree | 6eb4ca2d8332478d3653a5c0082b7496262c064f /LibCore/CIODevice.cpp | |
parent | 090e14d42ced127700c26089cbef8bd0e2271d4a (diff) | |
download | serenity-dbf7878998dca49012716370f412f446d9926310.zip |
LibCore: Using printf() inside CIODevices will now call CIODevice::printf().
Well this was confusing. Obviously this code should never be calling outside
to ::printf() anyway, so just use dbgprintf() instead.
Diffstat (limited to 'LibCore/CIODevice.cpp')
-rw-r--r-- | LibCore/CIODevice.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/LibCore/CIODevice.cpp b/LibCore/CIODevice.cpp index e393c26c02..6043011969 100644 --- a/LibCore/CIODevice.cpp +++ b/LibCore/CIODevice.cpp @@ -118,7 +118,7 @@ ByteBuffer CIODevice::read_line(int max_size) return { }; if (m_eof) { if (m_buffered_data.size() > max_size) { - printf("CIODevice::read_line: At EOF but there's more than max_size(%d) buffered\n", max_size); + dbgprintf("CIODevice::read_line: At EOF but there's more than max_size(%d) buffered\n", max_size); return { }; } auto buffer = ByteBuffer::copy(m_buffered_data.data(), m_buffered_data.size()); @@ -203,7 +203,9 @@ int CIODevice::printf(const char* format, ...) va_start(ap, format); // FIXME: We're not propagating write() failures to client here! int ret = printf_internal([this] (char*&, char ch) { - write((const byte*)&ch, 1); + int rc = write((const byte*)&ch, 1); + if (rc < 0) + dbgprintf("CIODevice::printf: write: %s\n", strerror(errno)); }, nullptr, format, ap); va_end(ap); return ret; |