From 21df7677a993e5a9e6d170dd98b70a1d2801958e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 25 Dec 2024 12:10:13 +0100 Subject: [PATCH] BUILD: mworker: always initialize the saveptr of strtok_r() Building with some libcs which define strtok_r() as an inline function can yield a possibly uninitialized warning due to a loop dereferencing this save pointer early, even though the doc clearly mentions that it is ignored. This is actually more of a mismatch between the compiler and the libc (gcc-4.7 and glibc-2.23 in that case). It's trivial to set s2 to NULL here so let's do it to please this old couple. Note that while the warning is triggered in all supported versions, there's no point backporting it since it's unlikely this combination will be relevant outside of backwards compatibility checks now. --- src/mworker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mworker.c b/src/mworker.c index 9096f0062..2cf188494 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -175,7 +175,7 @@ int mworker_env_to_proc_list() while ((token = strtok_r(msg, "|", &s1))) { char *subtoken = NULL; - char *s2; + char *s2 = NULL; msg = NULL; -- 2.47.3