From: Willy Tarreau Date: Wed, 25 Dec 2024 11:10:13 +0000 (+0100) Subject: BUILD: mworker: always initialize the saveptr of strtok_r() X-Git-Tag: v3.2-dev2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=21df7677a993e5a9e6d170dd98b70a1d2801958e;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/mworker.c b/src/mworker.c index 9096f00628..2cf1884947 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;