import-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 25509.

Change-Id: I58466f5d123da2b541a6a88b72bafa1f754a581e
This commit is contained in:
Horst Schirmeier
2015-02-07 15:58:23 +01:00
parent 2c6aa6cd37
commit 8e5cd0d632

View File

@ -175,7 +175,10 @@ int main(int argc, char *argv[]) {
} }
// Since the importer might have added command line options, we need to // Since the importer might have added command line options, we need to
// reparse all arguments. // 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) { if (cmd[HELP] || cmd[UNKNOWN] || cmd.parser()->nonOptionsCount() > 0) {
for (option::Option* opt = cmd[UNKNOWN]; opt; opt = opt->next()) { for (option::Option* opt = cmd[UNKNOWN]; opt; opt = opt->next()) {