From 55b46920bbcceaad6c71a74eb5877c0d2bebf673 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Wed, 1 May 2013 11:07:56 -0400 Subject: [PATCH] virsh: Resolve Coverity 'MISSING_BREAK' Recent commit '53531e16' resulted in a new Coverity warning regarding a missing break in the ':' options processing. Adjust the commit to avoid the issue. --- tools/virsh.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 7ef0bda291..bb79245e56 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3053,12 +3053,15 @@ vshParseArgv(vshControl *ctl, int argc, char **argv) break; case ':': for (i = 0; opt[i].name != NULL; i++) { - if (opt[i].val == optopt) { - vshError(ctl, _("option '-%c'/'--%s' requires an argument"), - optopt, opt[i].name); - exit(EXIT_FAILURE); - } + if (opt[i].val == optopt) + break; } + if (opt[i].name) + vshError(ctl, _("option '-%c'/'--%s' requires an argument"), + optopt, opt[i].name); + else + vshError(ctl, _("option '-%c' requires an argument"), optopt); + exit(EXIT_FAILURE); case '?': if (optopt) vshError(ctl, _("unsupported option '-%c'. See --help."), optopt); -- 2.39.5