TetherController: fix "tether interface list" command handling
It still silently accepts the extra argument.
Bug: 5327568
Change-Id: I4ac1bdb0e2d33133b3d5dbe11f6f94d503a28d11
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 31ae129..496d446 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -555,6 +555,12 @@
cli->sendMsg(ResponseCode::TetherStatusResult, tmp, false);
free(tmp);
return 0;
+ } else if (argc >= 3 && !strcmp(argv[1], "interface") && !strcmp(argv[2], "list")) {
+ InterfaceCollection *ilist = sTetherCtrl->getTetheredInterfaceList();
+ InterfaceCollection::iterator it;
+ for (it = ilist->begin(); it != ilist->end(); ++it) {
+ cli->sendMsg(ResponseCode::TetherInterfaceListResult, *it, false);
+ }
} else {
/*
* These commands take a minimum of 4 arguments
@@ -588,13 +594,7 @@
rc = sTetherCtrl->tetherInterface(argv[3]);
} else if (!strcmp(argv[2], "remove")) {
rc = sTetherCtrl->untetherInterface(argv[3]);
- } else if (!strcmp(argv[2], "list")) {
- InterfaceCollection *ilist = sTetherCtrl->getTetheredInterfaceList();
- InterfaceCollection::iterator it;
-
- for (it = ilist->begin(); it != ilist->end(); ++it) {
- cli->sendMsg(ResponseCode::TetherInterfaceListResult, *it, false);
- }
+ /* else if (!strcmp(argv[2], "list")) handled above */
} else {
cli->sendMsg(ResponseCode::CommandParameterError,
"Unknown tether interface operation", false);