From: Roy Marples Date: Thu, 11 Oct 2007 08:53:29 +0000 (+0000) Subject: Skip over bogus EINTR error on select when arp checking for a different address from... X-Git-Tag: v3.2.3~197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a31bd7a2adb330fc04ee7fa87f2844f12a95f3bf;p=thirdparty%2Fdhcpcd.git Skip over bogus EINTR error on select when arp checking for a different address from what we already have. This should not happen, so a better fix is probably needed. --- diff --git a/ChangeLog b/ChangeLog index 85de72f0..3c76ccc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Skip over bogus EINTR error on select when arp checking for a +different address from what we already have. This should not +happen, so a better fix is probably needed. + dhcpcd-3.1.6 --skiproutes has been added for no fork users so that we know if we can delete the route at a later date. diff --git a/arp.c b/arp.c index 405895ef..e2be80ca 100644 --- a/arp.c +++ b/arp.c @@ -141,10 +141,19 @@ int arp_claim (interface_t *iface, struct in_addr address) FD_ZERO (&rset); FD_SET (iface->fd, &rset); - errno = 0; - if ((s = select (FD_SETSIZE, &rset, NULL, NULL, &tv)) == -1) { - if (errno != EINTR) - logger (LOG_ERR, "select: `%s'", strerror (errno)); + if ((s = select (iface->fd + 1, &rset, NULL, NULL, &tv)) == -1) { + /* If anyone can explain why we get an EINTR when probing + * for an ip address we don't have assigned, I'd like to here + * from you - hopefully with a patch or info on how to fix. + * Note, no signal is really received, so it's probably a + * bogus error as we've done something wrong somewhere. + * Until then, we ignore it and continue. Or timeout an flood + * protection should be robust enough to cater for this. + * This happens on both Linux and FreeBSD. */ + if (errno == EINTR) + continue; + + logger (LOG_ERR, "select: `%s'", strerror (errno)); break; } }