summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kansho Nishida <kansho@google.com> 2019-06-24 22:03:07 +0900
committer Kansho Nishida <kansho@google.com> 2019-06-24 22:03:07 +0900
commit323343aa0ed4bb57df078af366efea3bc62165da (patch)
tree6ac84947acdececf5f70eb41d4e8e1d447bfe84d
parent8475fc34a2144b947db4f1a1170a01809e83479d (diff)
dumpstate: close socket after accepting
Close socket just after accept(), to make sure that connect() by client will get error when the socket is used by the other services. Bug: 135575100 Test: execute bugreport in parallel Change-Id: I4e8a46e41519fa97cf41dde8955cf37361c6fa99 Signed-off-by: Kansho Nishida <kansho@google.com>
-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;