summaryrefslogtreecommitdiff
path: root/adb/client/commandline.cpp
diff options
context:
space:
mode:
authorEric Arseneau <earseneau@google.com>2019-12-16 12:42:40 -0800
committerSteven Laver <lavers@google.com>2019-12-17 16:06:42 -0800
commiteae45d25367cd14cbe0b3ed92235b6f48c0afad5 (patch)
treea7b3b5463cd653676d9c7857842b2d55da4cb896 /adb/client/commandline.cpp
parent1a43c1292f22bb34a3741df64e292a5e3b331a2c (diff)
parentf0db8d044bbd06e824450e6673bacd8131a3c1f8 (diff)
Merge SPL-2019-12-05
Change-Id: I208823c4a4aa89ee4f3e9935762259184f9214a4
Diffstat (limited to 'adb/client/commandline.cpp')
-rw-r--r--adb/client/commandline.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp
index e2a17c553..8dd85d7b0 100644
--- a/adb/client/commandline.cpp
+++ b/adb/client/commandline.cpp
@@ -1668,17 +1668,29 @@ int adb_commandline(int argc, const char** argv) {
return 0;
}
} else if (!strcmp(argv[0], "rescue")) {
+ // adb rescue getprop
// adb rescue getprop <prop>
// adb rescue install <filename>
// adb rescue wipe userdata
- if (argc != 3) error_exit("rescue requires two arguments");
+ if (argc < 2) error_exit("rescue requires at least one argument");
if (!strcmp(argv[1], "getprop")) {
- return adb_connect_command(android::base::StringPrintf("rescue-getprop:%s", argv[2]));
+ if (argc == 2) {
+ return adb_connect_command("rescue-getprop:");
+ }
+ if (argc == 3) {
+ return adb_connect_command(
+ android::base::StringPrintf("rescue-getprop:%s", argv[2]));
+ }
+ error_exit("invalid rescue getprop arguments");
} else if (!strcmp(argv[1], "install")) {
+ if (argc != 3) error_exit("rescue install requires two arguments");
if (adb_sideload_install(argv[2], true /* rescue_mode */) != 0) {
return 1;
}
- } else if (!strcmp(argv[1], "wipe") && !strcmp(argv[2], "userdata")) {
+ } else if (!strcmp(argv[1], "wipe")) {
+ if (argc != 3 || strcmp(argv[2], "userdata") != 0) {
+ error_exit("invalid rescue wipe arguments");
+ }
return adb_wipe_devices();
} else {
error_exit("invalid rescue argument");