diff options
author | Simon Kelley <simon@thekelleys.org.uk> | 2015-03-11 21:36:30 +0000 |
---|---|---|
committer | Simon Kelley <simon@thekelleys.org.uk> | 2015-03-11 21:36:30 +0000 |
commit | ff841ebf5a5d6864ff48571f607c32ce80dbb75a (patch) | |
tree | 027985142b90373268a5aca31c0a74874a1c92cd /src/netlink.c | |
parent | 360f2513ab12a9bf1e262d388dd2ea8a566590a3 (diff) | |
download | dnsmasq-ff841ebf5a5d6864ff48571f607c32ce80dbb75a.tar.gz |
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.
Diffstat (limited to 'src/netlink.c')
-rw-r--r-- | src/netlink.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/netlink.c b/src/netlink.c index 10f94db..753784d 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -169,10 +169,10 @@ int iface_enumerate(int family, void *parm, int (*callback)()) req.g.rtgen_family = family; /* Don't block in recvfrom if send fails */ - while((len = sendto(daemon->netlinkfd, (void *)&req, sizeof(req), 0, - (struct sockaddr *)&addr, sizeof(addr))) == -1 && retry_send()); - - if (len == -1) + while(retry_send(sendto(daemon->netlinkfd, (void *)&req, sizeof(req), 0, + (struct sockaddr *)&addr, sizeof(addr)))); + + if (errno != 0) return 0; while (1) |