]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh.c: Fix compiler warning
authorCole Robinson <crobinso@redhat.com>
Sat, 11 Aug 2012 19:00:46 +0000 (15:00 -0400)
committerCole Robinson <crobinso@redhat.com>
Mon, 13 Aug 2012 19:33:44 +0000 (15:33 -0400)
For some reason I only get this after applying subsequent upcoming
patches that touch virsh, but don't seem to actually cause the warning.

virsh.c: In function ‘vshCommandParse’:
virsh.c:2014:46: error: ‘opt_index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors

tools/virsh.c

index b95a008af6bfff89ae102f677696c695824b220d..64e2e18a15c62831b1a218f1aa8d3ee20282b0c4 100644 (file)
@@ -1975,7 +1975,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
             } else if (tkdata[0] == '-' && tkdata[1] == '-' &&
                        c_isalnum(tkdata[2])) {
                 char *optstr = strchr(tkdata + 2, '=');
-                int opt_index;
+                int opt_index = 0;
 
                 if (optstr) {
                     *optstr = '\0'; /* convert the '=' to '\0' */