X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_tail.c;h=5b7551d3a18f4925cb0403f454350373c8c7c6e8;hb=46ba00ecd986212d2519791244c50b33e1b81397;hp=904a52122e7e40d4d6ebcc47788d218fe99888fa;hpb=c87da66245197f489bb0e9efffc23538cf07e70b;p=collectd.git diff --git a/src/utils_tail.c b/src/utils_tail.c index 904a5212..5b7551d3 100644 --- a/src/utils_tail.c +++ b/src/utils_tail.c @@ -220,6 +220,8 @@ int cu_tail_read (cu_tail_t *obj, char *buf, int buflen, tailfunc_t *callback, while (42) { + size_t len; + status = cu_tail_readline (obj, buf, buflen); if (status != 0) { @@ -232,6 +234,13 @@ int cu_tail_read (cu_tail_t *obj, char *buf, int buflen, tailfunc_t *callback, if (buf[0] == 0) break; + len = strlen (buf); + while (len > 0) { + if (buf[len - 1] != '\n') + break; + buf[len - 1] = '\0'; + } + status = callback (data, buf, buflen); if (status != 0) {