From 9420cfc0db94acb9a76a265c7fbd56065863934b Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Tue, 9 Apr 2024 15:28:00 +0200 Subject: [PATCH] CLEANUP: log: lf_text_len() returns a pointer not an integer In c83684519 ("MEDIUM: log: add the ability to include samples in logs") we checked the return value of lf_text_len() as an integer instead of comparing the pointer with NULL explicitly. Since this may be confusing, let's test the return value against NULL. [ada: for backports, the patch needs to be applied manually because of c6a713842 ("MINOR: log: simplify last_isspace in sess_build_logline()")] --- src/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/log.c b/src/log.c index 8c9180846..f404c808c 100644 --- a/src/log.c +++ b/src/log.c @@ -3038,7 +3038,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t key ? key->data.u.str.data : 0, dst + maxsize - tmplog, tmp); - if (ret == 0) + if (ret == NULL) goto out; tmplog = ret; break;