From: Antonio Quartulli Date: Sat, 1 May 2021 13:06:39 +0000 (+0200) Subject: windows: define variable only where used X-Git-Tag: v2.6_beta1~519 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00c36948297654d93174aed1f8244e6e6734e141;p=thirdparty%2Fopenvpn.git windows: define variable only where used warn_used is a static variable but that is used only under certain conditions. These conditions do not apply for Windows and therefore mingw is spitting a warning for unused variable. Move variable declaration inside code block that uses it. Fixes: run_command.c: In function ‘openvpn_popen’: run_command.c:236:17: warning: unused variable ‘warn_shown’ [-Wunused-variable] 236 | static bool warn_shown = false; | ^~~~~~~~~~ Signed-off-by: Antonio Quartulli Acked-by: Arne Schwabe Message-Id: <20210501130640.9330-3-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22265.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/run_command.c b/src/openvpn/run_command.c index 34f95c5ca..650876c1d 100644 --- a/src/openvpn/run_command.c +++ b/src/openvpn/run_command.c @@ -233,11 +233,11 @@ openvpn_popen(const struct argv *a, const struct env_set *es) { struct gc_arena gc = gc_new(); int ret = -1; - static bool warn_shown = false; if (a && a->argv[0]) { #if defined(ENABLE_FEATURE_EXECVE) + static bool warn_shown = false; if (script_security() >= SSEC_BUILT_IN) { const char *cmd = a->argv[0];