Fix boilerplate code for re-running system calls on EINTR and EAGAIN etc.

The nasty code with static variable in retry_send() which
avoids looping forever needs to be called on success of the syscall,
to reset the static variable.
This commit is contained in:
Simon Kelley
2015-03-11 21:36:30 +00:00
parent 360f2513ab
commit ff841ebf5a
11 changed files with 92 additions and 83 deletions

View File

@@ -225,9 +225,9 @@ void dhcp6_packet(time_t now)
if (port != 0)
{
from.sin6_port = htons(port);
while (sendto(daemon->dhcp6fd, daemon->outpacket.iov_base, save_counter(0),
0, (struct sockaddr *)&from, sizeof(from)) == -1 &&
retry_send());
while (retry_send(sendto(daemon->dhcp6fd, daemon->outpacket.iov_base,
save_counter(0), 0, (struct sockaddr *)&from,
sizeof(from))));
}
}