From: Mark Wielaard Date: Fri, 11 Jun 2010 12:20:08 +0000 (+0200) Subject: Don't double print error message on bad stap command line option. X-Git-Tag: release-1.3~253 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=36222574678f4499bbbce731de2a0ff3a53fb750;p=systemtap.git Don't double print error message on bad stap command line option. Bug introduced in commit db1354. getopt_long will already have printed an appropriate error message in case of an invalid/unrecognized option or an option missing an required argument. So don't print another error message in that case. * session.cxx (parse_cmdline): Silently handle '?' case. --- diff --git a/session.cxx b/session.cxx index 861398824..544e50a80 100644 --- a/session.cxx +++ b/session.cxx @@ -742,6 +742,13 @@ systemtap_session::parse_cmdline (int argc, char * const argv []) } break; + case '?': + // Invalid/unrecognized option given or argument required, but + // not given. In both cases getopt_long() will have printed the + // appropriate error message to stderr already. + return 1; + break; + default: // NOTREACHED unless one added a getopt option but not a corresponding switch/case: cerr << "Unhandled argument code " << (char)grc << endl;