summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntp.c
diff options
context:
space:
mode:
authorRafael Zalamena <rzalamena@cvs.openbsd.org>2016-09-26 16:55:03 +0000
committerRafael Zalamena <rzalamena@cvs.openbsd.org>2016-09-26 16:55:03 +0000
commit43dcae029b3d1cba3f171704896c501ff93043f5 (patch)
treeee9d2bfedf537997cecc31377e638f75d0b57d35 /usr.sbin/ntpd/ntp.c
parent8c86bb4c76322a7c1c70396c364ac03c08e95c6c (diff)
Teach ntpd(8) how to use socket status to shutdown the daemon. While at
it, remove some verbose shutdown messages that we had before with pipe close. ok reyk@
Diffstat (limited to 'usr.sbin/ntpd/ntp.c')
-rw-r--r--usr.sbin/ntpd/ntp.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 9c03747e33f..d3cb8ca461d 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.143 2016/09/14 13:20:16 rzalamena Exp $ */
+/* $OpenBSD: ntp.c,v 1.144 2016/09/26 16:55:02 rzalamena Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -425,14 +425,9 @@ ntp_dispatch_imsg(void)
struct imsg imsg;
int n;
- if ((n = imsg_read(ibuf_main)) == -1 && errno != EAGAIN)
+ if (((n = imsg_read(ibuf_main)) == -1 && errno != EAGAIN) || n == 0)
return (-1);
- if (n == 0) { /* connection closed */
- log_warnx("ntp_dispatch_imsg in ntp engine: pipe closed");
- return (-1);
- }
-
for (;;) {
if ((n = imsg_get(ibuf_main, &imsg)) == -1)
return (-1);
@@ -477,14 +472,9 @@ ntp_dispatch_imsg_dns(void)
struct ntp_addr *h;
int n;
- if ((n = imsg_read(ibuf_dns)) == -1)
+ if (((n = imsg_read(ibuf_dns)) == -1 && errno != EAGAIN) || n == 0)
return (-1);
- if (n == 0) { /* connection closed */
- log_warnx("ntp_dispatch_imsg_dns in ntp engine: pipe closed");
- return (-1);
- }
-
for (;;) {
if ((n = imsg_get(ibuf_dns, &imsg)) == -1)
return (-1);