summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-12-05 13:12:40 +0000
committerclaudio <claudio@openbsd.org>2015-12-05 13:12:40 +0000
commit262992b268fc3b58f97c1bfa1d8b3ddbefe5129c (patch)
tree362a04511fc9e35519f828456e85defde1edb91e
parentEAGAIN handling for imsg_read. OK henning@ benno@ (diff)
downloadwireguard-openbsd-262992b268fc3b58f97c1bfa1d8b3ddbefe5129c.tar.xz
wireguard-openbsd-262992b268fc3b58f97c1bfa1d8b3ddbefe5129c.zip
EAGAIN handling for imsg_read. OK henning@ benno@
-rw-r--r--usr.sbin/ospf6ctl/ospf6ctl.c4
-rw-r--r--usr.sbin/ospf6d/control.c5
-rw-r--r--usr.sbin/ospf6d/ospf6d.c6
-rw-r--r--usr.sbin/ospf6d/ospfe.c10
-rw-r--r--usr.sbin/ospf6d/rde.c10
5 files changed, 18 insertions, 17 deletions
diff --git a/usr.sbin/ospf6ctl/ospf6ctl.c b/usr.sbin/ospf6ctl/ospf6ctl.c
index f4bd8c5407d..ff1b844bcd9 100644
--- a/usr.sbin/ospf6ctl/ospf6ctl.c
+++ b/usr.sbin/ospf6ctl/ospf6ctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6ctl.c,v 1.42 2015/12/03 17:16:39 deraadt Exp $ */
+/* $OpenBSD: ospf6ctl.c,v 1.43 2015/12/05 13:12:40 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -243,7 +243,7 @@ main(int argc, char *argv[])
err(1, "write error");
while (!done) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
errx(1, "imsg_read error");
if (n == 0)
errx(1, "pipe closed");
diff --git a/usr.sbin/ospf6d/control.c b/usr.sbin/ospf6d/control.c
index b9d63249689..0820466a040 100644
--- a/usr.sbin/ospf6d/control.c
+++ b/usr.sbin/ospf6d/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.23 2015/02/10 05:39:10 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.24 2015/12/05 13:12:41 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -220,7 +220,8 @@ control_dispatch_imsg(int fd, short event, void *bula)
}
if (event & EV_READ) {
- if ((n = imsg_read(&c->iev.ibuf)) == -1 || n == 0) {
+ if (((n = imsg_read(&c->iev.ibuf)) == -1 && errno != EAGAIN) ||
+ n == 0) {
control_close(fd);
return;
}
diff --git a/usr.sbin/ospf6d/ospf6d.c b/usr.sbin/ospf6d/ospf6d.c
index 5757590ef92..d833792f8e0 100644
--- a/usr.sbin/ospf6d/ospf6d.c
+++ b/usr.sbin/ospf6d/ospf6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6d.c,v 1.28 2015/09/27 17:31:50 stsp Exp $ */
+/* $OpenBSD: ospf6d.c,v 1.29 2015/12/05 13:12:41 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -355,7 +355,7 @@ main_dispatch_ospfe(int fd, short event, void *bula)
int shut = 0, verbose;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
@@ -429,7 +429,7 @@ main_dispatch_rde(int fd, short event, void *bula)
int shut = 0;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c
index 07ab78083b5..2304a3516a1 100644
--- a/usr.sbin/ospf6d/ospfe.c
+++ b/usr.sbin/ospf6d/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.46 2015/09/27 17:31:50 stsp Exp $ */
+/* $OpenBSD: ospfe.c,v 1.47 2015/12/05 13:12:41 claudio Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -259,7 +259,7 @@ ospfe_dispatch_main(int fd, short event, void *bula)
unsigned int ifindex;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
@@ -273,7 +273,7 @@ ospfe_dispatch_main(int fd, short event, void *bula)
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
- fatal("ospfe_dispatch_main: imsg_read error");
+ fatal("ospfe_dispatch_main: imsg_get error");
if (n == 0)
break;
@@ -441,7 +441,7 @@ ospfe_dispatch_rde(int fd, short event, void *bula)
u_int16_t l, age;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
@@ -455,7 +455,7 @@ ospfe_dispatch_rde(int fd, short event, void *bula)
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
- fatal("ospfe_dispatch_rde: imsg_read error");
+ fatal("ospfe_dispatch_rde: imsg_get error");
if (n == 0)
break;
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c
index 59804704a95..1de5d140f40 100644
--- a/usr.sbin/ospf6d/rde.c
+++ b/usr.sbin/ospf6d/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.64 2015/09/27 17:31:50 stsp Exp $ */
+/* $OpenBSD: rde.c,v 1.65 2015/12/05 13:12:41 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -261,7 +261,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
u_int16_t l;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
@@ -278,7 +278,7 @@ rde_dispatch_imsg(int fd, short event, void *bula)
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
- fatal("rde_dispatch_imsg: imsg_read error");
+ fatal("rde_dispatch_imsg: imsg_get error");
if (n == 0)
break;
@@ -635,7 +635,7 @@ rde_dispatch_parent(int fd, short event, void *bula)
unsigned int ifindex;
if (event & EV_READ) {
- if ((n = imsg_read(ibuf)) == -1)
+ if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN)
fatal("imsg_read error");
if (n == 0) /* connection closed */
shut = 1;
@@ -649,7 +649,7 @@ rde_dispatch_parent(int fd, short event, void *bula)
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
- fatal("rde_dispatch_parent: imsg_read error");
+ fatal("rde_dispatch_parent: imsg_get error");
if (n == 0)
break;