summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-09-11 17:23:32 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-09-11 17:23:32 +0200
commit44ca0897af60c6568c7f51923dd0ad29b09b034d (patch)
tree69bb20887650b4bf76d0c07a9b6e1dd0a204f7ab /lib
parentbe22bb4527e3be70718dfee414e08b17c399f9fd (diff)
parentb0af360ccc38cbf3dd5b947c5948445bac8dd3ce (diff)
downloadbarebox-44ca0897af60c6568c7f51923dd0ad29b09b034d.tar.gz
barebox-44ca0897af60c6568c7f51923dd0ad29b09b034d.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'lib')
-rw-r--r--lib/ratp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/ratp.c b/lib/ratp.c
index 4c5c748b48..7801cae519 100644
--- a/lib/ratp.c
+++ b/lib/ratp.c
@@ -1734,11 +1734,12 @@ void ratp_close(struct ratp *ratp)
*
* Return: 0 if successful, a negative error code otherwise.
*/
-int ratp_send_complete(struct ratp *ratp, const void *data, size_t len,
+int ratp_send_complete(struct ratp *ratp, const uint8_t *data, size_t len,
void (*complete)(void *ctx, int status), void *complete_ctx)
{
struct ratp_internal *ri = ratp->internal;
struct ratp_message *msg;
+ int sent = 0;
if (!ri || ri->state != RATP_STATE_ESTABLISHED)
return -ENETDOWN;
@@ -1754,11 +1755,12 @@ int ratp_send_complete(struct ratp *ratp, const void *data, size_t len,
msg = xzalloc(sizeof(*msg));
msg->buf = xzalloc(sizeof(struct ratp_header) + now + 2);
msg->len = now;
- memcpy(msg->buf + sizeof(struct ratp_header), data, now);
+ memcpy(msg->buf + sizeof(struct ratp_header), data + sent, now);
list_add_tail(&msg->list, &ri->sendmsg);
len -= now;
+ sent += now;
}
msg->eor = 1;