From 36222574678f4499bbbce731de2a0ff3a53fb750 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 11 Jun 2010 14:20:08 +0200 Subject: [PATCH] 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. --- session.cxx | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.43.5