From c396513ae6f1ed149a7cd5cd6979a019aff6c327 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 5 Dec 2013 18:21:01 +0100 Subject: [PATCH] client: Let client_recv() not pass unparsed status,len to the caller. --- src/client/sock.c | 4 ++++ src/include/client/sock.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client/sock.c b/src/client/sock.c index ffabdc1..f4f4c55 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -213,6 +213,10 @@ sdb_client_recv(sdb_client_t *client, break; } + if (rstatus != UINT32_MAX) + /* remove status,len */ + sdb_strbuf_skip(buf, data_offset, 2 * sizeof(rstatus)); + if (code) *code = rstatus; diff --git a/src/include/client/sock.h b/src/include/client/sock.h index 5980d08..e33f4d7 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -99,10 +99,13 @@ sdb_client_send(sdb_client_t *client, * Receive data from the connection. All data is written to the specified * buffer. If specified, the returned status code is written to the memory * location pointed to by 'code'. In case of an error or an incomplete - * command, the status code is set to UINT32_MAX. + * command, the status code is set to UINT32_MAX. The returned data does not + * include the status code and message len as received from the remote side + * but only the data associated with the message. * * Returns: * - the number of bytes read + * (may be zero if the message did not include any data) * - a negative value on error */ ssize_t -- 2.30.2