]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Skip over bogus EINTR error on select when arp checking for a different address from...
authorRoy Marples <roy@marples.name>
Thu, 11 Oct 2007 08:53:29 +0000 (08:53 +0000)
committerRoy Marples <roy@marples.name>
Thu, 11 Oct 2007 08:53:29 +0000 (08:53 +0000)
ChangeLog
arp.c

index 85de72f047ac44086baf26b015f29874573a1d97..3c76ccc9c815d0b993a335b2735d09c9c4a27e35 100644 (file)
--- 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 405895efef47520a286acc0aeeb12ace1766b3ff..e2be80cacb63cf9a185db41811bd8641aba3cd66 100644 (file)
--- 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;
                        }
                }