summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2013-11-13 20:44:40 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2013-11-13 20:44:40 +0000
commitf30263fcc5def81c861170578c58bc96ac30320b (patch)
tree9e72404e93da47030f522befe71eefe3655c8c73
parentea792c44642668013aaad483e9a4748337b66c3d (diff)
from sthen: handle msgbuf_write() returning EAGAIN
ok krw
-rw-r--r--usr.sbin/ntpd/control.c4
-rw-r--r--usr.sbin/ntpd/ntp.c8
-rw-r--r--usr.sbin/ntpd/ntp_dns.c5
-rw-r--r--usr.sbin/ntpd/ntpd.c6
4 files changed, 13 insertions, 10 deletions
diff --git a/usr.sbin/ntpd/control.c b/usr.sbin/ntpd/control.c
index 121e5a475e4..88dc791377a 100644
--- a/usr.sbin/ntpd/control.c
+++ b/usr.sbin/ntpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.1 2013/10/04 14:28:16 phessler Exp $ */
+/* $OpenBSD: control.c,v 1.2 2013/11/13 20:44:39 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -184,7 +184,7 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt)
}
if (pfd->revents & POLLOUT)
- if (msgbuf_write(&c->ibuf.w) < 0) {
+ if (msgbuf_write(&c->ibuf.w) <= 0 && errno != EAGAIN) {
*ctl_cnt -= control_close(pfd->fd);
return (1);
}
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index a91dabb2db0..efe7ddcf863 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.119 2013/10/04 14:28:16 phessler Exp $ */
+/* $OpenBSD: ntp.c,v 1.120 2013/11/13 20:44:39 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -335,7 +335,8 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
}
if (nfds > 0 && (pfd[PFD_PIPE_MAIN].revents & POLLOUT))
- if (msgbuf_write(&ibuf_main->w) < 0) {
+ if (msgbuf_write(&ibuf_main->w) <= 0 &&
+ errno != EAGAIN) {
log_warn("pipe write error (to parent)");
ntp_quit = 1;
}
@@ -347,7 +348,8 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct ntpd_conf *nconf,
}
if (nfds > 0 && (pfd[PFD_PIPE_DNS].revents & POLLOUT))
- if (msgbuf_write(&ibuf_dns->w) < 0) {
+ if (msgbuf_write(&ibuf_dns->w) <= 0 &&
+ errno != EAGAIN) {
log_warn("pipe write error (to dns engine)");
ntp_quit = 1;
}
diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c
index 59d22a8b839..44148fe2641 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.3 2010/05/26 13:56:08 nicm Exp $ */
+/* $OpenBSD: ntp_dns.c,v 1.4 2013/11/13 20:44:39 benno Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@@ -97,7 +97,8 @@ ntp_dns(int pipe_ntp[2], struct ntpd_conf *nconf, struct passwd *pw)
}
if (nfds > 0 && (pfd[0].revents & POLLOUT))
- if (msgbuf_write(&ibuf_dns->w) < 0) {
+ if (msgbuf_write(&ibuf_dns->w) <= 0 &&
+ errno != EAGAIN) {
log_warn("pipe write error (to ntp engine)");
quit_dns = 1;
}
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index f2c760502a8..53433c556b4 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.74 2013/10/16 21:23:59 jmc Exp $ */
+/* $OpenBSD: ntpd.c,v 1.75 2013/11/13 20:44:39 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
}
if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT))
- if (msgbuf_write(&ibuf->w) < 0) {
+ if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN) {
log_warn("pipe write error (to child)");
quit = 1;
}
@@ -597,7 +597,7 @@ ctl_main(int argc, char *argv[])
}
while (ibuf_ctl->w.queued)
- if (msgbuf_write(&ibuf_ctl->w) < 0)
+ if (msgbuf_write(&ibuf_ctl->w) <= 0 && errno != EAGAIN)
err(1, "ibuf_ctl: msgbuf_write error");
done = 0;