]> git.ipfire.org Git - people/ms/dnsmasq.git/commitdiff
Handle EINTR return from sendto() in ipset.c
authorSimon Kelley <simon@thekelleys.org.uk>
Sat, 23 Feb 2013 19:22:37 +0000 (19:22 +0000)
committerSimon Kelley <simon@thekelleys.org.uk>
Sat, 23 Feb 2013 19:22:37 +0000 (19:22 +0000)
src/ipset.c

index c16cc8532d892b96d6a31226fdef08353c99d842..a34ed9677b90a8c42f3276cf8b60f3f93ab55964 100644 (file)
@@ -97,7 +97,8 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr,
   struct nlattr *nested[2];
   uint8_t proto;
   int addrsz = INADDRSZ;
-  
+  ssize_t rc;
+
 #ifdef HAVE_IPV6
   if (af == AF_INET6)
     addrsz = IN6ADDRSZ;
@@ -137,10 +138,9 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr,
   nested[1]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[1];
   nested[0]->nla_len = (void *)buffer + NL_ALIGN(nlh->nlmsg_len) - (void *)nested[0];
        
-  if (sendto(ipset_sock, buffer, nlh->nlmsg_len, 0, (struct sockaddr *)&snl, sizeof(snl)) < 0)
-    return -1;
-  
-  return 0;
+  while ((rc = sendto(ipset_sock, buffer, nlh->nlmsg_len, 0,
+                     (struct sockaddr *)&snl, sizeof(snl))) == -1 && retry_send());
+  return rc;
 }