From 71635bb966727cf01d1796be7012ba914cd3ebbe Mon Sep 17 00:00:00 2001 From: Spencer Low Date: Wed, 5 Aug 2015 19:26:50 -0700 Subject: [PATCH] adb: fix killing of old version of adb process The original code was: if (strcmp(__adb_error, "unknown host service") != 0) But that was changed by 078f0fcf4c63b8d8e8c10a18855eae04ca321e06 to: if (*error == "unknown host service") { I think the comparison should be != so that "unknown host service" falls-through and kills the server, and so if it is some other error, that the other error is returned immediately. Change-Id: Ia490a4a870d1d123a3c5ab258dd5fa0930e8032d Signed-off-by: Spencer Low --- adb/adb_client.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adb/adb_client.cpp b/adb/adb_client.cpp index 6d75966fd..afff2ef17 100644 --- a/adb/adb_client.cpp +++ b/adb/adb_client.cpp @@ -229,8 +229,9 @@ int adb_connect(const std::string& service, std::string* error) { } } else { // if fd is -1, then check for "unknown host service", - // which would indicate a version of adb that does not support the version command - if (*error == "unknown host service") { + // which would indicate a version of adb that does not support the + // version command, in which case we should fall-through to kill it. + if (*error != "unknown host service") { return fd; } }