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:
parent
9b9aa9a6e9
commit
32720b2ee6
2
procio.c
2
procio.c
@ -249,7 +249,7 @@ ssize_t proc_write(void *c, const char *buf, size_t count)
|
|||||||
do {
|
do {
|
||||||
token = NULL;
|
token = NULL;
|
||||||
if (cookie->offset > LINELEN)
|
if (cookie->offset > LINELEN)
|
||||||
token = (char*)memrchr(cookie->buf+offset, ',', LINELEN);
|
token = (char*)memrchr(cookie->buf+offset, cookie->delim, LINELEN);
|
||||||
else
|
else
|
||||||
token = (char*)memrchr(cookie->buf+offset, '\n', LINELEN);
|
token = (char*)memrchr(cookie->buf+offset, '\n', LINELEN);
|
||||||
if (token)
|
if (token)
|
||||||
|
Loading…
Reference in New Issue
Block a user