]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
When polling and interupted, continue as the signal will then be in our pipe.
authorRoy Marples <roy@marples.name>
Mon, 11 Feb 2008 21:43:34 +0000 (21:43 +0000)
committerRoy Marples <roy@marples.name>
Mon, 11 Feb 2008 21:43:34 +0000 (21:43 +0000)
client.c
signal.c

index e4d1019ea4b967a885202db17924b81a4037c690..3061a527e892dc42664b87e795a4d14e75a7f407 100644 (file)
--- a/client.c
+++ b/client.c
@@ -500,6 +500,10 @@ static int wait_for_packet (struct pollfd *fds, state_t *state,
                                        timeout = TIMEOUT_MINI_INF;
 
                                retval = poll (fds, 2, timeout * 1000);
+                               if (retval == -1 && errno == EINTR) {
+                                       retval = 0;
+                                       continue;
+                               }
                                if (retval == 0)
                                        _send_message (state, state->last_type,
                                                       options);
@@ -530,8 +534,12 @@ static int wait_for_packet (struct pollfd *fds, state_t *state,
                }
                timeout *= 1000;
                state->start = uptime ();
-               retval = poll (fds, iface->fd == -1 ? 1 : 2, timeout);
+               retval = poll (fds, 2, timeout);
                state->timeout -= uptime () - state->start;
+               if (retval == -1 && errno == EINTR) {
+                       retval = 0;
+                       continue;
+               }
                if (retval == 0 && iface->fd != -1 && state->timeout > 0)
                        _send_message (state, state->last_type, options);
        }
@@ -1039,7 +1047,7 @@ int dhcp_run (const options_t *options, int *pidfd)
        interface_t *iface;
        state_t *state = NULL;
        struct pollfd fds[] = {
-               { -1, POLLIN, 0 },
+               { -1, POLLIN | POLLERR | POLLPRI | POLLOUT | POLLERR | POLLHUP | POLLNVAL, 0 },
                { -1, POLLIN, 0 }
        };
        int retval = -1;
index 37b59e8f8beaacce78b14db4317cf2b4c0afc0a5..d37db63220026cd83ed4b37a329817217ef4b0ac 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -88,7 +88,6 @@ int signal_read (struct pollfd *fd)
        int sig = -1;
 
        /* Pop a signal off the our stack */
-
        if (signals[0]) {
                unsigned int i = 0;
                sig = signals[0];