summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kansho Nishida <kansho@google.com> 2019-06-28 13:35:23 -0700
committer android-build-merger <android-build-merger@google.com> 2019-06-28 13:35:23 -0700
commitcf141766bc3a07a438643a13b7cf11f32e3d0b8e (patch)
tree174d684a98e33f6898d3682d53816c7371e3013a
parent15cbec95a95dfb3f7b1565b11d820fb1b9dea4d3 (diff)
parent56a8c96e1f3f961e3bb830c47ab86f4c1e1c535a (diff)
Merge "dumpstate: close socket after accepting"
am: 56a8c96e1f Change-Id: I381f8beaa53083507ed19a70f6cc4280cc6a0aa5
-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;