From: Alex Rousskov Date: Mon, 11 Aug 2014 17:29:47 +0000 (-0600) Subject: Fixed reporting of malformed -n values on the command line. X-Git-Tag: SQUID_3_5_0_1~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8cb327e93a064e9886ccb57a4a85088976fe86c2;p=thirdparty%2Fsquid.git Fixed reporting of malformed -n values on the command line. Test case: $ squid -n ' ' FATAL: Expected alphanumeric service name for the -n option but got: squid --- diff --git a/src/main.cc b/src/main.cc index d2e71b9109..177b3625a9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -511,8 +511,10 @@ mainParseOptions(int argc, char *argv[]) const SBuf t(optarg); ::Parser::Tokenizer tok(t); const CharacterSet chr = CharacterSet::ALPHA+CharacterSet::DIGIT; - if (!tok.prefix(service_name, chr) || !tok.atEnd()) - fatalf("Expected alphanumeric service name for the -n option but got: " SQUIDSBUFPH, SQUIDSBUFPRINT(service_name)); + if (!tok.prefix(service_name, chr)) + fatalf("Expected alphanumeric service name for the -n option but got: %s", optarg); + if (!tok.atEnd()) + fatalf("Garbage after alphanumeric service name in the -n option value: %s", optarg); if (service_name.length() > 32) fatalf("Service name (-n option) must be limited to 32 characters but got %u", service_name.length()); opt_signal_service = true;