]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
We should inspect our signal fd before processing ARP replies.
authorRoy Marples <roy@marples.name>
Wed, 28 May 2008 12:02:04 +0000 (12:02 +0000)
committerRoy Marples <roy@marples.name>
Wed, 28 May 2008 12:02:04 +0000 (12:02 +0000)
net.c

diff --git a/net.c b/net.c
index efd2b6e17a384b0e285d4c337ec645a50a041dfe..f0e26e3de67623274052dec6aaa8c3c1e7644201 100644 (file)
--- a/net.c
+++ b/net.c
@@ -683,15 +683,8 @@ arp_claim(struct interface *iface, struct in_addr address)
                if (timeout > 0) {
                        s = poll(fds, 2, timeout);
                        if (s == -1) {
-                               if (errno == EINTR) {
-                                       if (signal_exists(NULL) == -1) {
-                                               errno = 0;
-                                               continue;
-                                       } else
-                                               break;
-                               }
-
-                               logger(LOG_ERR, "poll: `%s'", strerror(errno));
+                               if (errno != EINTR)
+                                       logger(LOG_ERR, "poll: `%s'", strerror(errno));
                                break;
                        }
                }
@@ -743,6 +736,12 @@ arp_claim(struct interface *iface, struct in_addr address)
                        continue;
                }
 
+               /* Check if signalled */
+               if ((fds[0].revents & POLLIN)) {
+                       errno = EINTR;
+                       return -1;
+               }
+
                if (!(fds[1].revents & POLLIN))
                        continue;
                for(;;) {
@@ -787,6 +786,7 @@ arp_claim(struct interface *iface, struct in_addr address)
                               inet_ntoa(reply_ipv4),
                               hwaddr_ntoa((unsigned char *)&reply_mac,
                                           (size_t)reply.ar_hln));
+                       errno = EEXIST;
                        retval = -1;
                        goto eexit;
                }