From acff905dfeb2055f0e78d5b5ea0763896e9577d3 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 7 Sep 2017 13:12:00 -0400 Subject: Fix bad write if a socket error occurred using --dump-traces Found by Coverity --- src/cli/tls_server.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli/tls_server.cpp b/src/cli/tls_server.cpp index fba0aa95f..92d227673 100644 --- a/src/cli/tls_server.cpp +++ b/src/cli/tls_server.cpp @@ -200,11 +200,6 @@ class TLS_Server final : public Command uint8_t buf[4 * 1024] = { 0 }; ssize_t got = ::read(fd, buf, sizeof(buf)); - if(dump_stream) - { - dump_stream->write(reinterpret_cast(buf), got); - } - if(got == -1) { error_output() << "Error in socket read - " << strerror(errno) << std::endl; @@ -217,6 +212,11 @@ class TLS_Server final : public Command break; } + if(dump_stream) + { + dump_stream->write(reinterpret_cast(buf), got); + } + server.received_data(buf, got); while(server.is_active() && !pending_output.empty()) -- cgit v1.2.3