Commit ab6ede7e authored by Simon Kelley's avatar Simon Kelley

Handle EINTR return from sendto() in ipset.c

parent b3538f11
...@@ -97,6 +97,7 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr, ...@@ -97,6 +97,7 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr,
struct nlattr *nested[2]; struct nlattr *nested[2];
uint8_t proto; uint8_t proto;
int addrsz = INADDRSZ; int addrsz = INADDRSZ;
ssize_t rc;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
if (af == AF_INET6) if (af == AF_INET6)
...@@ -137,10 +138,9 @@ static int new_add_to_ipset(const char *setname, const struct all_addr *ipaddr, ...@@ -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[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]; 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) while ((rc = sendto(ipset_sock, buffer, nlh->nlmsg_len, 0,
return -1; (struct sockaddr *)&snl, sizeof(snl))) == -1 && retry_send());
return rc;
return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment