diff options
author | Max Kellermann <max@duempel.org> | 2008-10-17 23:23:54 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-17 23:23:54 +0200 |
commit | 79459d08d9897317ba3b526fbf813e0ef2fb96b5 (patch) | |
tree | fb80333689ebddaf0f4451667622f905508ec5c4 /src/client.c | |
parent | ae6ca0b8aff0fdedda7f978ff02d810f1d619bd7 (diff) | |
download | mpd-79459d08d9897317ba3b526fbf813e0ef2fb96b5.tar.gz mpd-79459d08d9897317ba3b526fbf813e0ef2fb96b5.tar.xz mpd-79459d08d9897317ba3b526fbf813e0ef2fb96b5.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/client.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c index f3e2b32a4..bac65bcc0 100644 --- a/src/client.c +++ b/src/client.c @@ -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) { |