prune-trace: check 2nd cmd.parse() return value

As the first cmd.parse() call was already checked before, parsing a
second time should never fail.  Nevertheless, we can look at the
return value without much effort.  Found by Coverity Scan, CID 25494.

Change-Id: Id012cf7183fe7b2022d33e6cbcb19ba49b544c99
This commit is contained in:
Horst Schirmeier
2015-02-07 15:58:23 +01:00
parent 6a0214b132
commit 48423054b0

View File

@ -102,7 +102,10 @@ int main(int argc, char *argv[]) {
}
// Since the pruner might have added command line options, we need to
// reparse all arguments.
cmd.parse();
if (!cmd.parse()) {
std::cerr << "Error parsing arguments." << std::endl;
exit(-1);
}
if (cmd[HELP] || cmd[UNKNOWN] || cmd.parser()->nonOptionsCount() > 0) {
for (option::Option* opt = cmd[UNKNOWN]; opt; opt = opt->next()) {