mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
Fix synchronous readline "\n" handling.
Our function to read a line with a timeout handles newlines as requests to refresh the timeout, however the code kept subtracting the buffer size left every time a newline was received, for a bug in the loop logic. Fixed by this commit.
This commit is contained in:
parent
55ba772703
commit
7ab3af0edc
@ -138,6 +138,9 @@ ssize_t syncReadLine(int fd, char *ptr, ssize_t size, long long timeout) {
|
||||
*ptr = '\0';
|
||||
if (nread && *(ptr-1) == '\r') *(ptr-1) = '\0';
|
||||
return nread;
|
||||
} else {
|
||||
/* Read again with a fresh timeout. */
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
*ptr++ = c;
|
||||
|
Loading…
x
Reference in New Issue
Block a user