summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-02-07 20:03:44 +0000
committerChris Wilson <chris+github@qwirx.com>2014-02-07 20:03:44 +0000
commit8631c4fe809ab9b57212f345394e4532ad272983 (patch)
treeaf8519267a62a53e5d94f2a2e4c6037839283b67 /bin
parentb2501248e2251d6601fbf2ad60ceb328d110593a (diff)
Fix bbackupquery accepting a command starting with options.
This should never have been a valid command, but was accepted before, and silently ignored because it was treated as an empty command. This obscured bad quoting of bbackupquery command-line arguments, allowing commands to appear to work, but not do what you expected.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupquery/CommandCompletion.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/bbackupquery/CommandCompletion.cpp b/bin/bbackupquery/CommandCompletion.cpp
index 93c4d3fd..3bc79f3a 100644
--- a/bin/bbackupquery/CommandCompletion.cpp
+++ b/bin/bbackupquery/CommandCompletion.cpp
@@ -510,8 +510,10 @@ BackupQueries::ParsedCommand::ParsedCommand(const std::string& Command,
{
inQuoted = true;
}
- // Start of options?
- else if(currentArg.empty() && *c == '-')
+ // Start of options? You can't have options if there's no
+ // command before them, so treat the options as a command (which
+ // doesn't exist, so it will fail to parse) in that case.
+ else if(currentArg.empty() && *c == '-' && !mCmdElements.empty())
{
mInOptions = true;
}