]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
windows: define variable only where used
authorAntonio Quartulli <antonio@openvpn.net>
Sat, 1 May 2021 13:06:39 +0000 (15:06 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 2 May 2021 20:38:06 +0000 (22:38 +0200)
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 <antonio@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
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 <gert@greenie.muc.de>
src/openvpn/run_command.c

index 34f95c5ca080709b9b102e620dee57b3c62e3ba6..650876c1d623854a3b29377b9d364410c647f573 100644 (file)
@@ -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];