]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MINOR: cli: shut a minor gcc warning in "show fd"
authorWilly Tarreau <w@1wt.eu>
Wed, 9 Aug 2017 14:35:44 +0000 (16:35 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Aug 2017 14:35:44 +0000 (16:35 +0200)
Recent commit 7a4a0ac ("MINOR: cli: add a new "show fd" command") introduced
a warning when building at -O2 and above. The compiler doesn't know if a
variable's value might have changed between two if blocks so warns that some
values might be used uninitialized, which is not the case. Let's simply
initialize them to shut the warning.

src/cli.c

index 649881592a713d6d6b65cac9598acbe984e0e27e..6172b485791d8f986a5495b8daaff5db25f23ba3 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -755,10 +755,10 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
         */
        while (fd < maxfd) {
                struct fdtab fdt;
-               struct listener *li;
-               struct server *sv;
-               struct proxy *px;
-               uint32_t conn_flags;
+               struct listener *li = NULL;
+               struct server *sv = NULL;
+               struct proxy *px = NULL;
+               uint32_t conn_flags = 0;
 
                fdt = fdtab[fd];