Fix: may be used uninitialized trace_name variable
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 18 Dec 2018 20:47:20 +0000 (15:47 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:09:19 +0000 (00:09 -0400)
commit6672c9efe1e1ab04f22a8abbd77f8adb5bcefb0a
tree45661d9e576d8fad01af823ae86d167fda38bcfb
parentc8351c9eceb58e10eff864713a40e7bdd479568c
Fix: may be used uninitialized trace_name variable

This fixes the following Clang warning:
  dmesg.c:263:7: error: variable 'trace_name' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                if (strcmp(basename, G_DIR_SEPARATOR_S) != 0 &&
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  dmesg.c:269:6: note: uninitialized use occurs here
          if (trace_name) {
              ^~~~~~~~~~
  dmesg.c:263:3: note: remove the 'if' if its condition is always true
                  if (strcmp(basename, G_DIR_SEPARATOR_S) != 0 &&
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  dmesg.c:263:7: error: variable 'trace_name' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
                  if (strcmp(basename, G_DIR_SEPARATOR_S) != 0 &&
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  dmesg.c:269:6: note: uninitialized use occurs here
          if (trace_name) {
              ^~~~~~~~~~
  dmesg.c:263:7: note: remove the '&&' if its condition is always true
                  if (strcmp(basename, G_DIR_SEPARATOR_S) != 0 &&
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  dmesg.c:248:24: note: initialize the variable 'trace_name' to silence this warning
          const char *trace_name;

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
plugins/text/dmesg/dmesg.c
This page took 0.025212 seconds and 5 git commands to generate.