Module: check_mk
Branch: master
Commit: faff77559ecc25d552af04b2fd85526a51d9c8ab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=faff77559ecc25…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon May 15 10:15:15 2017 +0200
4688 FIX Emit error message in livestatus response
When the 'fixed16' response format is used, the Livestatus response should
contain the actual error message when something goes wrong. This was broken
in the 1.4 series and has been fixed now.
Change-Id: Icb2af944ac25601c0626d7aa59f67f6a92ec5cc2
---
.werks/4688 | 12 ++++++++++++
livestatus/src/OutputBuffer.cc | 4 +++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/4688 b/.werks/4688
new file mode 100644
index 0000000..fda9acb
--- /dev/null
+++ b/.werks/4688
@@ -0,0 +1,12 @@
+Title: Emit error message in livestatus response
+Level: 1
+Component: livestatus
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1494835970
+Class: fix
+
+When the 'fixed16' response format is used, the Livestatus response should
+contain the actual error message when something goes wrong. This was broken
+in the 1.4 series and has been fixed now.
diff --git a/livestatus/src/OutputBuffer.cc b/livestatus/src/OutputBuffer.cc
index 673cb64..474c4ba 100644
--- a/livestatus/src/OutputBuffer.cc
+++ b/livestatus/src/OutputBuffer.cc
@@ -55,7 +55,9 @@ OutputBuffer::~OutputBuffer() { flush(); }
void OutputBuffer::flush() {
if (_response_header == ResponseHeader::fixed16) {
if (_response_code != ResponseCode::ok) {
- _os.str(_error_message);
+ _os.clear();
+ _os.str("");
+ _os << _error_message;
}
auto code = static_cast<unsigned>(_response_code);
size_t size = _os.tellp();