summaryrefslogtreecommitdiffstats
path: root/usr.sbin/npppd
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-12-05 13:19:32 +0000
committerclaudio <claudio@openbsd.org>2015-12-05 13:19:32 +0000
commit1f82c02d178597ef5080a9610badd3504bca5640 (patch)
treef55183b1b58b606291755ba25483b8b134bac7a1 /usr.sbin/npppd
parentEAGAIN handling for imsg_read. OK henning@ benno@ (diff)
downloadwireguard-openbsd-1f82c02d178597ef5080a9610badd3504bca5640.tar.xz
wireguard-openbsd-1f82c02d178597ef5080a9610badd3504bca5640.zip
EAGAIN handling for imsg_read. OK henning@ benno@
Diffstat (limited to 'usr.sbin/npppd')
-rw-r--r--usr.sbin/npppd/npppd/control.c8
-rw-r--r--usr.sbin/npppd/npppd/privsep.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/npppd/npppd/control.c b/usr.sbin/npppd/npppd/control.c
index 54fb8081c71..03fb68a2723 100644
--- a/usr.sbin/npppd/npppd/control.c
+++ b/usr.sbin/npppd/npppd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.3 2015/01/19 01:48:59 deraadt Exp $ */
+/* $OpenBSD: control.c,v 1.4 2015/12/05 13:19:32 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -262,12 +262,12 @@ control_dispatch_imsg(int fd, short event, void *arg)
return;
}
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, cs);
return;
}
- } else
- fatalx("unknown event");
+ }
for (;;) {
if ((n = imsg_get(&c->iev.ibuf, &imsg)) == -1) {
diff --git a/usr.sbin/npppd/npppd/privsep.c b/usr.sbin/npppd/npppd/privsep.c
index 9726366c43f..68b64ea8a9e 100644
--- a/usr.sbin/npppd/npppd/privsep.c
+++ b/usr.sbin/npppd/npppd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.18 2015/10/11 07:32:06 guenther Exp $ */
+/* $OpenBSD: privsep.c,v 1.19 2015/12/05 13:19:32 claudio Exp $ */
/*
* Copyright (c) 2010 Yasuoka Masahiko <yasuoka@openbsd.org>
@@ -956,7 +956,7 @@ imsg_read_and_get(struct imsgbuf *ibuf, struct imsg *imsg)
for (;;) {
if ((n = imsg_read(ibuf)) <= 0) {
- if (n == 0 && (errno == EAGAIN || errno == EINTR))
+ if (n == -1 && (errno == EAGAIN || errno == EINTR))
continue;
return (-1);
}