health dyncfg userconfig: remove first newline (#17834)
Ilya Mashchenko committed
Jun 6, 2024 at 18:21 UTC
704d3b87365038a3938c28cccbc3dc4b2ac1f889
1 file changed
+6
-2
src/health/health_dyncfg.c
+6
-2
@@ -384,13 +384,17 @@ int dyncfg_health_prototype_to_conf(BUFFER *wb, RRD_ALERT_PROTOTYPE *ap, const c
384
wb->content_type = CT_TEXT_PLAIN;
385
wb->expires = now_realtime_sec();
386
387
+ int n = 0;
388
for(RRD_ALERT_PROTOTYPE *nap = ap; nap ; nap = nap->_internal.next) {
389
+ if(++n > 1)
390
+ buffer_sprintf(wb, "\n");
391
+
392
if(nap->match.is_template) {
389
- buffer_sprintf(wb, "\n%13s: %s\n", "template", name);
393
+ buffer_sprintf(wb, "%13s: %s\n", "template", name);
394
buffer_sprintf(wb, "%13s: %s\n", "on", string2str(nap->match.on.context));
395
}
396
else {
393
- buffer_sprintf(wb, "\n%13s: %s\n", "alarm", name);
397
+ buffer_sprintf(wb, "%13s: %s\n", "alarm", name);
398
buffer_sprintf(wb, "%13s: %s\n", "on", string2str(nap->match.on.chart));
399
}
400