From 32720b2ee6c36b84005a002def17e79e3ab009e1 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Fri, 8 Jun 2018 13:27:20 +0200 Subject: [PATCH] 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. --- procio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/procio.c b/procio.c index ad9b4de6..2813cd51 100644 --- a/procio.c +++ b/procio.c @@ -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)