From: Sebastian Harl Date: Thu, 5 Dec 2013 17:21:01 +0000 (+0100) Subject: client: Let client_recv() not pass unparsed status,len to the caller. X-Git-Tag: sysdb-0.1.0~328 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c396513ae6f1ed149a7cd5cd6979a019aff6c327;p=sysdb.git client: Let client_recv() not pass unparsed status,len to the caller. --- 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