]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: init: avoid a build warning on FreeBSD with USE_PROCCTL
authorWilly Tarreau <w@1wt.eu>
Fri, 8 Oct 2021 13:55:13 +0000 (15:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Oct 2021 15:21:48 +0000 (17:21 +0200)
It was brought by a variable declared after some statements in commit
21185970c ("MINOR: proc: setting the process to produce a core dump on
FreeBSD."). It's worth noting that some versions of clang seem to ignore
-Wdeclaration-after-statement by default. No backport is needed.

src/haproxy.c

index 5e4fe2b3d512d64b6f85113d36fd694e6f839408..1ab2bf618a159ff7d227c4ba444601a026b32143 100644 (file)
@@ -3384,10 +3384,12 @@ int main(int argc, char **argv)
                        ha_warning("[%s.main()] Failed to set the dumpable flag, "
                                   "no core will be dumped.\n", argv[0]);
 #elif defined(USE_PROCCTL)
-               int traceable = PROC_TRACE_CTL_ENABLE;
-               if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &traceable) == -1)
-                       ha_warning("[%s.main()] Failed to set the traceable flag, "
-                                  "no core will be dumped.\n", argv[0]);
+               {
+                       int traceable = PROC_TRACE_CTL_ENABLE;
+                       if (procctl(P_PID, getpid(), PROC_TRACE_CTL, &traceable) == -1)
+                               ha_warning("[%s.main()] Failed to set the traceable flag, "
+                                          "no core will be dumped.\n", argv[0]);
+               }
 #endif
        }