port: fix fda initialization.

Initialize all descriptors to prevent polling invalid descriptors from
faulty ports.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2014-11-06 09:52:49 +01:00 committed by Richard Cochran
parent 6b05b4e7d3
commit 594f59c50d
1 changed files with 2 additions and 2 deletions

4
port.c
View File

@ -1401,7 +1401,7 @@ static void port_disable(struct port *p)
for (i = 0; i < N_TIMER_FDS; i++) { for (i = 0; i < N_TIMER_FDS; i++) {
close(p->fda.fd[FD_ANNOUNCE_TIMER + i]); close(p->fda.fd[FD_ANNOUNCE_TIMER + i]);
} }
port_clear_fda(p, N_TIMER_FDS); port_clear_fda(p, N_POLLFD);
clock_fda_changed(p->clock); clock_fda_changed(p->clock);
} }
@ -2485,7 +2485,7 @@ struct port *port_open(int phc_index,
} }
p->nrate.ratio = 1.0; p->nrate.ratio = 1.0;
port_clear_fda(p, N_TIMER_FDS); port_clear_fda(p, N_POLLFD);
p->fault_fd = -1; p->fault_fd = -1;
if (number) { if (number) {
p->fault_fd = timerfd_create(CLOCK_MONOTONIC, 0); p->fault_fd = timerfd_create(CLOCK_MONOTONIC, 0);