aboutsummaryrefslogtreecommitdiffstats
path: root/adb/commandline.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2011-01-31 14:23:56 +0100
committerDavid 'Digit' Turner <digit@google.com>2011-01-31 14:23:56 +0100
commit305b4b0f6069d733d3023a57fdc8a6d9cf7de2a6 (patch)
tree525cb3cdaeb49377b3f3c8f778bb40ea5ca43830 /adb/commandline.c
parent63e99f447fed821b57f3f13e33abd740b3b04c03 (diff)
downloadsystem_core-305b4b0f6069d733d3023a57fdc8a6d9cf7de2a6.tar.gz
system_core-305b4b0f6069d733d3023a57fdc8a6d9cf7de2a6.tar.bz2
system_core-305b4b0f6069d733d3023a57fdc8a6d9cf7de2a6.zip
adb: Fix command-line parser.
This fixes the command-line parser to accept both "daemon server" and "server nodaemon". Before the patch, the second string would ignore the "nodaemon" flag. Fixes b/2191598 Change-Id: Ie922b3e7bf57a6e334fc448cec33fb340ca6abc4
Diffstat (limited to 'adb/commandline.c')
-rw-r--r--adb/commandline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/adb/commandline.c b/adb/commandline.c
index 3600e5a0..5ed1b522 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -683,6 +683,7 @@ int adb_commandline(int argc, char **argv)
char buf[4096];
int no_daemon = 0;
int is_daemon = 0;
+ int is_server = 0;
int persist = 0;
int r;
int quote;
@@ -719,7 +720,9 @@ int adb_commandline(int argc, char **argv)
/* modifiers and flags */
while(argc > 0) {
- if(!strcmp(argv[0],"nodaemon")) {
+ if(!strcmp(argv[0],"server")) {
+ is_server = 1;
+ } else if(!strcmp(argv[0],"nodaemon")) {
no_daemon = 1;
} else if (!strcmp(argv[0], "fork-server")) {
/* this is a special flag used only when the ADB client launches the ADB Server */
@@ -766,7 +769,7 @@ int adb_commandline(int argc, char **argv)
adb_set_transport(ttype, serial);
adb_set_tcp_specifics(server_port);
- if ((argc > 0) && (!strcmp(argv[0],"server"))) {
+ if (is_server) {
if (no_daemon || is_daemon) {
r = adb_main(is_daemon, server_port);
} else {