diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 7c54e401..94bc7219 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -1018,7 +1018,6 @@ int Params::getopt(int argc, char* const Argv[]) int rc = Util::Getopt::getopt(argc, argv, optstring_); // Further consistency checks if (help_ || version_) { - rc = 0; goto cleanup; } if (action_ == Action::none) { diff --git a/src/getopt.cpp b/src/getopt.cpp index 0d60e849..78a96abc 100644 --- a/src/getopt.cpp +++ b/src/getopt.cpp @@ -103,7 +103,7 @@ namespace Util { progname_ = Util::basename(argv[0]); Util::optind = 0; // reset the Util::Getopt scanner - for (;;) { + for (;!errcnt_;) { int c = Util::getopt(argc, argv, optstring.c_str()); if (c == -1) { break;