Fix 'adb backup' command line validation
The host side wasn't properly checking for argument-list sufficiency *after* removing any [-f filename] sequence. Fixes bug 5164135 Change-Id: I7bc49e37ef168182088e0e664b6897dd2a088ebf
This commit is contained in:
parent
5da93589f1
commit
bb86bc5892
1 changed files with 3 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue