Package: conky
Version: 1.10.8-1
tags: patch

Dear Maintainers, 

Conky will keep an internal list of all seen network interfaces, which
is limited to 64. If the number of these interfaces exceeds this limit,
conky will crash.

While this limit is large enough for most usecases, on a system where
interfaces often appear and disappear (for example by starting
docker-images) conky will eventually run into that limit.

The supplied patch avoids that issue by removing old network interfaces
from the said internal list, once they disappear.

Kind Regards,
Michael Stummvoll
diff --git a/conky-1.10.8/src/linux.cc b/patched/src/linux.cc
index ef39bd0..e4c9fe6 100644
--- a/conky-1.10.8/src/linux.cc
+++ b/patched/src/linux.cc
@@ -408,6 +408,10 @@ int update_net_stats(void)
 		return 0;
 	}
 
+	for (i2 = 0; i2 < MAX_NET_INTERFACES; i2++) {
+		netstats[i].up = false;
+	}
+
 	/* open file /proc/net/dev. If not something went wrong, clear all
 	 * network statistics */
 	if (!(net_dev_fp = open_file("/proc/net/dev", &rep))) {
@@ -686,6 +690,12 @@ int update_net_stats(void)
 	}
 #endif /* BUILD_IPV6 */
 
+	for (i = 0; i < MAX_NET_INTERFACES; i++) {
+		if(netstats[i].dev && !netstats[i].up) {
+			netstats[i].dev = 0;
+		}
+	}
+
 	first = 0;
 
 	fclose(net_dev_fp);

Reply via email to