Fix mDNS socket leak during network configuration changes
Several rather important close() calls were embedded within
assert() macros. Not a good idea, as the macros don't compile
into anything at all in non-debug builds, and the close() calls
disappear entirely. This could eventually lead to failure of
the mDNS daemon when its file-descriptor table fills up with
orphans.
Bug: 13490553
Change-Id: I5978c055e8475d8f5be7e0242b80593b45ed71a1
diff --git a/mDNSPosix/mDNSUNP.c b/mDNSPosix/mDNSUNP.c
index fb107b5..64f66e1 100755
--- a/mDNSPosix/mDNSUNP.c
+++ b/mDNSPosix/mDNSUNP.c
@@ -205,7 +205,9 @@
}
done:
if (sockfd != -1) {
- assert(close(sockfd) == 0);
+// __ANDROID__ : replaced assert(close(..))
+ int sockfd_closed = close(sockfd);
+ assert(sockfd_closed == 0);
}
return(ifihead); /* pointer to first structure in linked list */
}