summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kansho Nishida <kansho@google.com> 2019-06-28 13:41:23 -0700
committer android-build-merger <android-build-merger@google.com> 2019-06-28 13:41:23 -0700
commit475d217e19b8e20748ad9de0084e0d39edf7a8c5 (patch)
tree41ab0d41fc2f274746ff76f8a3a30ed857c08685
parent6da5978189b6a2eaafcea1fb3331688674bd0304 (diff)
parentcf141766bc3a07a438643a13b7cf11f32e3d0b8e (diff)
Merge "dumpstate: close socket after accepting" am: 56a8c96e1f
am: cf141766bc Change-Id: Id7c546efc15e233be2bb299936647fa31cb15a73
-rw-r--r--cmds/dumpstate/utils.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 0bb80dcfba..4cbf5776d3 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -733,6 +733,11 @@ int open_socket(const char *service) {
struct sockaddr addr;
socklen_t alen = sizeof(addr);
int fd = accept(s, &addr, &alen);
+
+ // Close socket just after accept(), to make sure that connect() by client will get error
+ // when the socket is used by the other services.
+ close(s);
+
if (fd < 0) {
MYLOGE("accept(control socket): %s\n", strerror(errno));
return -1;