From: Roy Marples Date: Tue, 19 Feb 2008 09:57:27 +0000 (+0000) Subject: Add comments about interupts and stop polling for events we ignore. X-Git-Tag: v3.2.3~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d934a0ae46eaca1b32074fc324a8102e48f3103;p=thirdparty%2Fdhcpcd.git Add comments about interupts and stop polling for events we ignore. --- diff --git a/client.c b/client.c index 3061a527..6ab672b5 100644 --- 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;