]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add comments about interupts and stop polling for events we ignore.
authorRoy Marples <roy@marples.name>
Tue, 19 Feb 2008 09:57:27 +0000 (09:57 +0000)
committerRoy Marples <roy@marples.name>
Tue, 19 Feb 2008 09:57:27 +0000 (09:57 +0000)
client.c

index 3061a527e892dc42664b87e795a4d14e75a7f407..6ab672b57475cbdf3076e4eb0fc8a67c716413ce 100644 (file)
--- a/client.c
+++ b/client.c
@@ -501,6 +501,9 @@ static int wait_for_packet (struct pollfd *fds, state_t *state,
 
                                retval = poll (fds, 2, timeout * 1000);
                                if (retval == -1 && errno == EINTR) {
+                                       /* If interupted, continue as normal as
+                                        * the signal will be delivered down
+                                        * the pipe */
                                        retval = 0;
                                        continue;
                                }
@@ -534,9 +537,11 @@ static int wait_for_packet (struct pollfd *fds, state_t *state,
                }
                timeout *= 1000;
                state->start = uptime ();
-               retval = poll (fds, 2, timeout);
+               retval = poll (fds, iface->fd == -1 ? 1 : 2, timeout);
                state->timeout -= uptime () - state->start;
                if (retval == -1 && errno == EINTR) {
+                       /* If interupted, continue as normal as the signal
+                        * will be delivered down the pipe */
                        retval = 0;
                        continue;
                }
@@ -1047,7 +1052,7 @@ int dhcp_run (const options_t *options, int *pidfd)
        interface_t *iface;
        state_t *state = NULL;
        struct pollfd fds[] = {
-               { -1, POLLIN | POLLERR | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL, 0 },
+               { -1, POLLIN, 0 },
                { -1, POLLIN, 0 }
        };
        int retval = -1;