]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: use __send_log() with exact payload length
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 11:52:17 +0000 (12:52 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 5 Mar 2025 14:38:46 +0000 (15:38 +0100)
Historically, __send_log() was called with terminating NULL byte after
the message payload. But now that __send_log() supports being called
without terminating NULL byte (thanks to size hint), and that __sendlog()
actually stips any \n or NULL byte, we don't need to bother with that
anymore. So let's remove extra logic around __send_log() users where we
added 1 extra byte for the terminating NULL byte.

No change of behavior should be expected.

src/log.c

index 6be7fd222774a9e9bf076ab017632aa8b98c8b3c..4557c181d4d3699a69d90047e0a4098f01fb0bf8 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -5229,7 +5229,7 @@ void do_log(struct session *sess, struct stream *s, struct log_orig origin)
                ctx.sess = sess;
                ctx.stream = s;
                __send_log(&ctx, &sess->fe->loggers, &sess->fe->log_tag, level,
-                          logline, size + 1, logline_rfc5424, sd_size);
+                          logline, size, logline_rfc5424, sd_size);
        }
 }
 
@@ -5288,7 +5288,7 @@ void strm_log(struct stream *s, struct log_orig origin)
                ctx.sess = sess;
                ctx.stream = s;
                __send_log(&ctx, &sess->fe->loggers, &sess->fe->log_tag, level,
-                          logline, size + 1, logline_rfc5424, sd_size);
+                          logline, size, logline_rfc5424, sd_size);
                s->logs.logwait = 0;
        }
 }
@@ -5358,7 +5358,7 @@ void _sess_log(struct session *sess, int embryonic)
                ctx.stream = NULL;
                __send_log(&ctx, &sess->fe->loggers,
                           &sess->fe->log_tag, level,
-                          logline, size + 1, logline_rfc5424, sd_size);
+                          logline, size, logline_rfc5424, sd_size);
        }
 }