View | Details | Raw Unified | Return to bug 27592
Collapse All | Expand All

(-)a/openntpd/client.c (-5 / +12 lines)
Lines 94-101 client_addr_init(struct ntp_peer *p) Link Here
94
int
94
int
95
client_nextaddr(struct ntp_peer *p)
95
client_nextaddr(struct ntp_peer *p)
96
{
96
{
97
	close(p->query->fd);
97
	if (p->query->fd != -1) {
98
	p->query->fd = -1;
98
		close(p->query->fd);
99
		p->query->fd = -1;
100
	}
99
101
100
	if (p->addr_head.a == NULL) {
102
	if (p->addr_head.a == NULL) {
101
		priv_host_dns(p->addr_head.name, p->id);
103
		priv_host_dns(p->addr_head.name, p->id);
Lines 129-136 client_query(struct ntp_peer *p) Link Here
129
		struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;
131
		struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;
130
132
131
		if ((p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM,
133
		if ((p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM,
132
		    0)) == -1)
134
		    0)) == -1) {
133
			fatal("client_query socket");
135
			if (errno == EAFNOSUPPORT) {
136
				client_nextaddr(p);
137
				set_next(p, error_interval());
138
				return (-1);
139
			} else
140
				fatal("client_query socket");
141
		}
134
		if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) {
142
		if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) {
135
			if (errno == ECONNREFUSED || errno == ENETUNREACH ||
143
			if (errno == ECONNREFUSED || errno == ENETUNREACH ||
136
			    errno == EHOSTUNREACH) {
144
			    errno == EHOSTUNREACH) {
137
- 

Return to bug 27592