Commit 79459d08 authored by Max Kellermann's avatar Max Kellermann

client: handle partial lines correctly

Commit 6eb62e47 didn't obey partial lines correctly: when a line wasn't finished in one read, the first part was ignored when the rest arrived.
parent ae6ca0b8
......@@ -445,12 +445,12 @@ static int client_process_line(struct client *client, char *line)
static int client_input_received(struct client *client, int bytesRead)
{
char *start = client->buffer + client->bufferLength;
char *end = start + bytesRead;
char *start = client->buffer + client->bufferPos, *end;
char *newline, *next;
int ret;
client->bufferLength += bytesRead;
end = client->buffer + client->bufferLength;
/* process all lines */
while ((newline = memchr(start, '\n', end - start)) != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment