diff options
author | José Bollo <jose.bollo@iot.bzh> | 2020-02-07 13:48:32 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2020-02-07 14:34:18 +0100 |
commit | 68ccab4ecb17aa3266565eb72b2659c0efa3abaf (patch) | |
tree | f3d6346a44fe579be84d01f3715a06c8e8f55246 | |
parent | 384f2e70fe4bc5bdfd9f35c4347351a985f23d14 (diff) |
Fix a bug in protocol
Correctly handle the impossibility to add the
tailing record separator.
Bug-AGL: SPEC-3168
Change-Id: Id611eda4c6517819c1209baeb58c2d8d8ff57183
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | src/prot.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } |