From a0cbec4329a7086bc8efaa617f9781c6214e5695 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 2 Aug 2023 23:19:30 +0200 Subject: [PATCH] Support of output failure for serialization of strings --- m-serial-json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m-serial-json.h b/m-serial-json.h index d71bede9..379b2004 100644 --- a/m-serial-json.h +++ b/m-serial-json.h @@ -81,7 +81,7 @@ m_ser1al_json_write_string(m_serial_write_t serial, const char data[], size_t le v2->u.heap.alloc = length + 1; v2->ptr = (char*)ptr; m_string_out_str(f, v2); - return M_SERIAL_OK_DONE; + return M_UNLIKELY(ferror(f)) ? m_core_serial_fail() : M_SERIAL_OK_DONE; } /* Start writing an array of 'number_of_elements' objects into the serial stream 'serial'.