BUG/MINOR: log: limit the size of the startup-logs

This is an alternative to mainline commit 869efd5eeb ("BUG/MINOR: log:
make "show startup-log" use a ring buffer instead"). Instead of relying
on a log buffer, it limits the size of logs to bufsize. This avoids
taking O(N^2) time to start up in case a large config produces many
warnings. Typically a 100k backend config with one warning each could
take roughly 20 minutes just to produce the message which in the end
was not retrievable over the CLI, while now it takes roughly 0.5s.

The commit mentioned above requires backporting the ring infrastructure
which seems overkill just to fix this.

This must be backported to 1.9.
diff --git a/src/log.c b/src/log.c
index 99f185e..1778be9 100644
--- a/src/log.c
+++ b/src/log.c
@@ -1034,7 +1034,8 @@
 		  label, tm.tm_yday, tm.tm_hour, tm.tm_min, tm.tm_sec, (int)getpid());
 	memvprintf(&msg, fmt, argp);
 
-	if (global.mode & MODE_STARTING)
+	if (global.mode & MODE_STARTING &&
+	    (!startup_logs || strlen(startup_logs) + strlen(head) + strlen(msg) < global.tune.bufsize))
 		memprintf(&startup_logs, "%s%s%s", (startup_logs ? startup_logs : ""), head, msg);
 
 	fprintf(stderr, "%s%s", head, msg);