Skip to content
Snippets Groups Projects
Commit 5f70059b authored by Steven Murray's avatar Steven Murray
Browse files

cta-acsd now displays an error when it is passed an empty command-line argument

parent 5927e6ff
No related branches found
No related tags found
No related merge requests found
......@@ -85,6 +85,18 @@ AcsdCmdLine AcsdCmdLine::parse(const int argc, char *const *const argv) {
const int expectedNbNonOptionalArgs = 0;
const int nbNonOptionalArgs = argc - optind;
// Check for empty string arguments
// These might have been passed in by systemd
for(int i = optind; i < argc; i++) {
if(std::string(argv[i]).empty()) {
exception::Exception ex;
ex.getMessage() << "Incorrect command-line arguments: Encountered an empty string argument at argv[" << i
<< "]\n\n" << getUsage();
throw ex;
}
}
if (expectedNbNonOptionalArgs != nbNonOptionalArgs) {
exception::Exception ex;
ex.getMessage() << "Incorrect command-line arguments: Incorrect number of non-optional arguments: expected=" <<
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment