From: Florian Forster Date: Tue, 8 May 2007 20:44:51 +0000 (+0200) Subject: src/types_list.c: Strip newlines from the end of the line. X-Git-Tag: collectd-4.0.0~46^2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=71172f66592ef942ad4a092adff54180a699269d;p=collectd.git src/types_list.c: Strip newlines from the end of the line. --- diff --git a/src/types_list.c b/src/types_list.c index 3963897e..002761ce 100644 --- a/src/types_list.c +++ b/src/types_list.c @@ -158,6 +158,13 @@ static void parse_file (FILE *fh) if ((buf_len == 0) || (buf[0] == '#')) continue; + while ((buf_len > 0) && ((buf[buf_len - 1] == '\n') + || (buf[buf_len - 1] == '\n'))) + buf[--buf_len] = '\0'; + + if (buf_len == 0) + continue; + parse_line (buf, buf_len); } /* while (fgets) */ } /* void parse_file */