procio: use the user-supplied delimiter to split large input

The `fprocopen` function allows users to specify a delimiter chacter
that is used to split very large input lines into smaller chunks. While
the code checks that the caller did actually supply the delimiter, it is
in fact never used to split the string. Instead, the hardcoded default
character ',' is always used to split the string.

Fix the issue by using `cookie->delim` instead.
This commit is contained in:
Patrick Steinhardt 2018-06-08 13:27:20 +02:00 committed by Craig Small
parent 9b9aa9a6e9
commit 32720b2ee6

View File

@ -249,7 +249,7 @@ ssize_t proc_write(void *c, const char *buf, size_t count)
do {
token = NULL;
if (cookie->offset > LINELEN)
token = (char*)memrchr(cookie->buf+offset, ',', LINELEN);
token = (char*)memrchr(cookie->buf+offset, cookie->delim, LINELEN);
else
token = (char*)memrchr(cookie->buf+offset, '\n', LINELEN);
if (token)