From: Cole Robinson Date: Sat, 11 Aug 2012 19:00:46 +0000 (-0400) Subject: virsh.c: Fix compiler warning X-Git-Tag: v0.10.0-rc1~162 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7d1bdfbd20987a6f2bdeec4b1bc4e38ce24b64d;p=thirdparty%2Flibvirt.git virsh.c: Fix compiler warning 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 --- diff --git a/tools/virsh.c b/tools/virsh.c index b95a008af6..64e2e18a15 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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' */