summaryrefslogtreecommitdiffstats
path: root/adb
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2011-01-31 14:23:56 +0100
committerMike Lockwood <lockwood@android.com>2011-02-03 15:26:43 -0500
commiteb5df470e6e0402006030b76315f06bcb4f17882 (patch)
tree33583c811b2052a797ab4a4abc7f529a100cde69 /adb
parenta5d469484660513e47b074b9d7fff17475a68efc (diff)
downloadsystem_core-eb5df470e6e0402006030b76315f06bcb4f17882.zip
system_core-eb5df470e6e0402006030b76315f06bcb4f17882.tar.gz
system_core-eb5df470e6e0402006030b76315f06bcb4f17882.tar.bz2
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')
-rw-r--r--adb/commandline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/adb/commandline.c b/adb/commandline.c
index 3600e5a..5ed1b52 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 {