adb: start-server and kill-server error output
- handle_host_request
- When the host:kill command comes in, shutdown the socket before
calling exit(). If we don't do this, the client will output error info
even though everything is working ok.
- adb_connect()
- If we can't parse the version string, explain this in error output
and don't goto error which would try to close an fd we already closed.
- If host:kill doesn't work, output error info. Don't try to close
already closed fd.
- adb_main()
- If writing the ACK somehow has an error, output error info (I doubt
this will ever get hit).
- adb_commandline()
- Fix typo about max port number.
- Make 'adb kill-server' and 'adb start-server' output any detailed
error info.
Change-Id: Id1a309cc1bf516f7f49bd332b34d30f148b406da
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
diff --git a/adb/client/main.cpp b/adb/client/main.cpp
index fca1762..cd06f4b 100644
--- a/adb/client/main.cpp
+++ b/adb/client/main.cpp
@@ -178,7 +178,9 @@
#else
// TODO(danalbert): Can't use SendOkay because we're sending "OK\n", not
// "OKAY".
- android::base::WriteStringToFd("OK\n", ack_reply_fd);
+ if (!android::base::WriteStringToFd("OK\n", ack_reply_fd)) {
+ fatal_errno("error writing ACK to fd %d", ack_reply_fd);
+ }
unix_close(ack_reply_fd);
#endif
close_stdin();