From 68ccab4ecb17aa3266565eb72b2659c0efa3abaf Mon Sep 17 00:00:00 2001 From: José Bollo Date: Fri, 7 Feb 2020 13:48:32 +0100 Subject: Fix a bug in protocol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correctly handle the impossibility to add the tailing record separator. Bug-AGL: SPEC-3168 Change-Id: Id611eda4c6517819c1209baeb58c2d8d8ff57183 Signed-off-by: José Bollo --- src/prot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/prot.c b/src/prot.c index 7edcc50..2714e2f 100644 --- a/src/prot.c +++ b/src/prot.c @@ -387,7 +387,8 @@ prot_put_end( rc = 0; else { rc = buf_put_car(&prot->outbuf, RECORD_SEPARATOR); - prot->outfields = 0; + if (rc == 0) + prot->outfields = 0; } return rc; } @@ -440,10 +441,10 @@ prot_put( int rc; rc = prot_put_fields(prot, count, fields); + if (!rc) + rc = prot_put_end(prot); if (rc) prot_put_cancel(prot); - else - rc = prot_put_end(prot); return rc; } -- cgit 1.2.3-korg