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
This commit is contained in:
Cole Robinson 2012-08-11 15:00:46 -04:00
parent 7e6f80107c
commit e7d1bdfbd2

View 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' */