[PATCH 2/3] dnsproxy: Check the result of socket creation when resolving

patrik.flykt at linux.intel.com patrik.flykt at linux.intel.com
Mon Nov 19 00:48:04 PST 2012


From: Patrik Flykt <patrik.flykt at linux.intel.com>

If the socket creation failed, continue with the next server.
---
 src/dnsproxy.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 01bcc51..7de4e38 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2229,8 +2229,12 @@ static gboolean resolv(struct request_data *req,
 		if (data->enabled == FALSE)
 			continue;
 
-		if (data->channel == NULL && data->protocol == IPPROTO_UDP)
-			server_create_socket(data);
+		if (data->channel == NULL && data->protocol == IPPROTO_UDP) {
+			if (server_create_socket(data) < 0) {
+				DBG("socket creation failed while resolving");
+				continue;
+			}
+		}
 
 		if (ns_resolv(data, req, request, name) > 0)
 			return TRUE;
-- 
1.7.10.4




More information about the connman mailing list