From: Michał Mirosław Date: Sat, 14 Jun 2008 00:29:05 +0000 (+0200) Subject: src/common.c: Add end-of-line characters to strsplit() X-Git-Tag: collectd-4.4.2~4^2~7 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ccf53eef1685e77696fe94d78ca5e20afcb85c7b;p=collectd.git src/common.c: Add end-of-line characters to strsplit() This fixes plugins that use it to break lines read using fgets() and forget that "\n" is left at the buffer's end. At least battery and wireless plugins is affected. Signed-off-by: Michał Mirosław Signed-off-by: Florian Forster --- diff --git a/src/common.c b/src/common.c index 5c3db5dd..56fa6962 100644 --- a/src/common.c +++ b/src/common.c @@ -224,7 +224,7 @@ int strsplit (char *string, char **fields, size_t size) i = 0; ptr = string; saveptr = NULL; - while ((fields[i] = strtok_r (ptr, " \t", &saveptr)) != NULL) + while ((fields[i] = strtok_r (ptr, " \t\r\n", &saveptr)) != NULL) { ptr = NULL; i++;