summaryrefslogtreecommitdiffstats
path: root/updater/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'updater/commands.cpp')
-rw-r--r--updater/commands.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/updater/commands.cpp b/updater/commands.cpp
index fb19ebc9a..e88149678 100644
--- a/updater/commands.cpp
+++ b/updater/commands.cpp
@@ -29,8 +29,16 @@
using namespace std::string_literals;
+bool Command::abort_allowed_ = false;
+
Command::Type Command::ParseType(const std::string& type_str) {
- if (type_str == "bsdiff") {
+ if (type_str == "abort") {
+ if (!abort_allowed_) {
+ LOG(ERROR) << "ABORT disallowed";
+ return Type::LAST;
+ }
+ return Type::ABORT;
+ } else if (type_str == "bsdiff") {
return Type::BSDIFF;
} else if (type_str == "erase") {
return Type::ERASE;
@@ -237,6 +245,13 @@ Command Command::Parse(const std::string& line, size_t index, std::string* err)
src_hash, &source_info, err)) {
return {};
}
+ } else if (op == Type::ABORT) {
+ // No-op, other than sanity checking the input args.
+ if (pos != tokens.size()) {
+ *err = android::base::StringPrintf("invalid number of args: %zu (expected 0)",
+ tokens.size() - pos);
+ return {};
+ }
} else {
*err = "invalid op";
return {};