summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/client.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-07-09 15:02:16 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-07-09 15:02:16 +0000
commit01f7cb51c66776dd3d5bfd9b0e5a6089f6038c98 (patch)
treea721ec62538f2bf5129dac6f729311328ee36069 /usr.sbin/ntpd/client.c
parent53ffc60a4372284765807b0beeb7d123c1a1b642 (diff)
don't panic when sendto() fails; for the client part just re-schedule
noticed & fix tested by fries@
Diffstat (limited to 'usr.sbin/ntpd/client.c')
-rw-r--r--usr.sbin/ntpd/client.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c
index 873056c5806..7c2503e1359 100644
--- a/usr.sbin/ntpd/client.c
+++ b/usr.sbin/ntpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.18 2004/07/09 10:53:33 henning Exp $ */
+/* $OpenBSD: client.c,v 1.19 2004/07/09 15:02:15 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -104,8 +104,12 @@ client_query(struct ntp_peer *p)
p->query->msg.xmttime.fraction = arc4random();
p->query->xmttime = gettime();
- ntp_sendmsg(p->query->fd, (struct sockaddr *)&p->addr->ss,
- &p->query->msg, NTP_MSGSIZE_NOAUTH, 0);
+ if (ntp_sendmsg(p->query->fd, (struct sockaddr *)&p->addr->ss,
+ &p->query->msg, NTP_MSGSIZE_NOAUTH, 0) == -1) {
+ p->next = time(NULL) + INTERVAL_QUERY_PATHETIC;
+ return (-1);
+ }
+
p->state = STATE_QUERY_SENT;
p->next = 0;
p->deadline = time(NULL) + QUERYTIME_MAX;