collectd-mod-ipstatistics: fix handling of long `/proc` lines

`/proc/net/netstat` `TcpExt:` line is 2064 chars long on linux 6.1

Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
[PKG_RELEASE bump added]
This commit is contained in:
Alex Shumsky 2023-09-01 20:51:40 +03:00 committed by Hannu Nyman
parent 4299e892de
commit b5bf5927f7
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=collectd PKG_NAME:=collectd
PKG_VERSION:=5.12.0 PKG_VERSION:=5.12.0
PKG_RELEASE:=47 PKG_RELEASE:=48
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://collectd.org/files/ \ PKG_SOURCE_URL:=https://collectd.org/files/ \

View File

@ -41,7 +41,7 @@
+ +
+int ipstatistics_read() { +int ipstatistics_read() {
+ FILE *fh; + FILE *fh;
+ char buffer[1024]; + char buffer[4096];
+ char *fields[19]; + char *fields[19];
+ int numfields; + int numfields;
+ +
@ -56,7 +56,7 @@
+ return -1; + return -1;
+ } + }
+ +
+ while (fgets(buffer, 1024, fh) != NULL) { + while (fgets(buffer, 4096, fh) != NULL) {
+ numfields = strsplit(buffer, fields, 2); + numfields = strsplit(buffer, fields, 2);
+ +
+ if (numfields < 2) + if (numfields < 2)
@ -80,7 +80,7 @@
+ } + }
+ +
+ int count_ipext = 0; + int count_ipext = 0;
+ while (fgets(buffer, 1024, fh) != NULL) { + while (fgets(buffer, 4096, fh) != NULL) {
+ numfields = strsplit(buffer, fields, 19); + numfields = strsplit(buffer, fields, 19);
+ +
+ if (numfields < 8) + if (numfields < 8)