Fix fast_readline to handle windows line endings (\r\n)

Change-Id: I3561eff9bc4e244a84ef4afee26a40432d1073dd
This commit is contained in:
Jonathan Gordon 2012-07-05 23:00:31 +10:00
parent 4c94b98422
commit f6d6a4602c

View file

@ -198,6 +198,13 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
next = ++p;
}
if ( (p = strchr(buf, '\r')) != NULL)
{
*p = '\0';
if (!next)
next = ++p;
}
rc = callback(count, buf, parameters);
if (rc < 0)
return rc;