summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-14 22:43:27 +0200
committerGravatar Martin Szulecki2020-06-14 22:43:27 +0200
commitc2e65ff7d2c4a7bc03ba98906009c581d77a1b9f (patch)
tree35053870742e48c5ed5b27a99bb75032b3b5aeb0
parent01752b5dcb825910f802344b70d22c7a708ac33d (diff)
downloadlibirecovery-c2e65ff7d2c4a7bc03ba98906009c581d77a1b9f.tar.gz
libirecovery-c2e65ff7d2c4a7bc03ba98906009c581d77a1b9f.tar.bz2
irecovery: Return an error if no action option was used
-rw-r--r--tools/irecovery.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c
index c32a7f9..48a69f6 100644
--- a/tools/irecovery.c
+++ b/tools/irecovery.c
@@ -43,6 +43,7 @@
#define debug(...) if(verbose) fprintf(stderr, __VA_ARGS__)
enum {
+ kNoAction,
kResetDevice,
kStartShell,
kSendCommand,
@@ -377,7 +378,7 @@ static void print_usage(int argc, char **argv) {
int main(int argc, char* argv[]) {
int i = 0;
int opt = 0;
- int action = 0;
+ int action = kNoAction;
unsigned long long ecid = 0;
int mode = -1;
char* argument = NULL;
@@ -461,6 +462,12 @@ int main(int argc, char* argv[]) {
}
}
+ if (action == kNoAction) {
+ fprintf(stderr, "ERROR: Missing action option\n");
+ print_usage(argc, argv);
+ return -1;
+ }
+
if (verbose)
irecv_set_debug_level(verbose);