summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-12-05 13:12:16 +0000
committerclaudio <claudio@openbsd.org>2015-12-05 13:12:16 +0000
commit1a2f066818ca7893e05f75dbf7699099bde16610 (patch)
tree5f6abef039338d86d7c8d4f6a3b7b79268fc4f34
parentEAGAIN handling for imsg_read. OK henning@ benno@ (diff)
downloadwireguard-openbsd-1a2f066818ca7893e05f75dbf7699099bde16610.tar.xz
wireguard-openbsd-1a2f066818ca7893e05f75dbf7699099bde16610.zip
EAGAIN handling for imsg_read. OK henning@ benno@
-rw-r--r--usr.sbin/ntpd/constraint.c5
-rw-r--r--usr.sbin/ntpd/control.c4
-rw-r--r--usr.sbin/ntpd/ntp.c4
-rw-r--r--usr.sbin/ntpd/ntp_dns.c4
-rw-r--r--usr.sbin/ntpd/ntpd.c6
5 files changed, 12 insertions, 11 deletions
diff --git a/usr.sbin/ntpd/constraint.c b/usr.sbin/ntpd/constraint.c
index 1c9d2890aa3..dd81153b6f0 100644
--- a/usr.sbin/ntpd/constraint.c
+++ b/usr.sbin/ntpd/constraint.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: constraint.c,v 1.22 2015/11/24 01:03:25 deraadt Exp $ */
+/* $OpenBSD: constraint.c,v 1.23 2015/12/05 13:12:16 claudio Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -27,6 +27,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -526,7 +527,7 @@ priv_constraint_dispatch(struct pollfd *pfd)
if (!(pfd->revents & POLLIN))
return (0);
- if ((n = imsg_read(&cstr->ibuf)) == -1 || n == 0) {
+ if (((n = imsg_read(&cstr->ibuf)) == -1 && errno != EAGAIN) || n == 0) {
priv_constraint_close(pfd->fd, 1);
return (1);
}
diff --git a/usr.sbin/ntpd/control.c b/usr.sbin/ntpd/control.c
index 4f31836b81d..1ca323dbd0e 100644
--- a/usr.sbin/ntpd/control.c
+++ b/usr.sbin/ntpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.8 2015/11/20 18:53:42 tedu Exp $ */
+/* $OpenBSD: control.c,v 1.9 2015/12/05 13:12:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -195,7 +195,7 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt)
if (!(pfd->revents & POLLIN))
return (0);
- if ((n = imsg_read(&c->ibuf)) == -1 || n == 0) {
+ if (((n = imsg_read(&c->ibuf)) == -1 && errno != EAGAIN) || n == 0) {
*ctl_cnt -= control_close(pfd->fd);
return (1);
}
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 84098159ef4..cde9154827a 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.139 2015/10/30 16:41:53 reyk Exp $ */
+/* $OpenBSD: ntp.c,v 1.140 2015/12/05 13:12:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -428,7 +428,7 @@ ntp_dispatch_imsg(void)
struct imsg imsg;
int n;
- if ((n = imsg_read(ibuf_main)) == -1)
+ if ((n = imsg_read(ibuf_main)) == -1 && errno != EAGAIN)
return (-1);
if (n == 0) { /* connection closed */
diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c
index 72cf19be23c..538ff360c07 100644
--- a/usr.sbin/ntpd/ntp_dns.c
+++ b/usr.sbin/ntpd/ntp_dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp_dns.c,v 1.14 2015/10/25 10:52:48 deraadt Exp $ */
+/* $OpenBSD: ntp_dns.c,v 1.15 2015/12/05 13:12:16 claudio Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@@ -145,7 +145,7 @@ dns_dispatch_imsg(void)
struct ibuf *buf;
const char *str;
- if ((n = imsg_read(ibuf_dns)) == -1)
+ if ((n = imsg_read(ibuf_dns)) == -1 && errno != EAGAIN)
return (-1);
if (n == 0) { /* connection closed */
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 81fded1e9d4..99e0acfd82c 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.99 2015/11/24 01:03:25 deraadt Exp $ */
+/* $OpenBSD: ntpd.c,v 1.100 2015/12/05 13:12:16 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -357,7 +357,7 @@ dispatch_imsg(struct ntpd_conf *lconf, const char *pw_dir,
int n;
double d;
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
return (-1);
if (n == 0) { /* connection closed */
@@ -662,7 +662,7 @@ ctl_main(int argc, char *argv[])
done = 0;
while (!done) {
- if ((n = imsg_read(ibuf_ctl)) == -1)
+ if ((n = imsg_read(ibuf_ctl)) == -1 && errno != EAGAIN)
err(1, "ibuf_ctl: imsg_read error");
if (n == 0)
errx(1, "ntpctl: pipe closed");