diff --git a/adb/commandline.c b/adb/commandline.c index a69f86776..75f337b45 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -579,9 +579,6 @@ static int backup(int argc, char** argv) { int fd, outFd; int i, j; - /* bare "adb backup" is not a valid command */ - if (argc < 2) return usage(); - /* find, extract, and use any -f argument */ for (i = 1; i < argc; i++) { if (!strcmp("-f", argv[i])) { @@ -598,6 +595,9 @@ static int backup(int argc, char** argv) { } } + /* bare "adb backup" or "adb backup -f filename" are not valid invocations */ + if (argc < 2) return usage(); + outFd = adb_open_mode(filename, O_WRONLY | O_CREAT | O_TRUNC, 0640); if (outFd < 0) { fprintf(stderr, "adb: unable to open file %s\n", filename);