Merge "dumpstate: close socket after accepting" am: 56a8c96e1f am: cf141766bc
am: 475d217e19
Change-Id: Ib80de0ffae5c1c9e8d8283ccaba1af23f401f0d9
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 0bb80dc..4cbf577 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -733,6 +733,11 @@
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;