summaryrefslogtreecommitdiffstats
path: root/usr.sbin/switchd
diff options
context:
space:
mode:
authorrzalamena <rzalamena@openbsd.org>2016-08-08 16:49:17 +0000
committerrzalamena <rzalamena@openbsd.org>2016-08-08 16:49:17 +0000
commit1869e46caf56959e43f0adee84af6e6670727079 (patch)
tree27bae10fedec382173d7a584a3b0c9feaefffbe6 /usr.sbin/switchd
parentrde and eigrpe should use exit(3) instead of _exit(2) (diff)
downloadwireguard-openbsd-1869e46caf56959e43f0adee84af6e6670727079.tar.xz
wireguard-openbsd-1869e46caf56959e43f0adee84af6e6670727079.zip
Handle imsg_read() EAGAIN like the man page code example.
ok reyk@
Diffstat (limited to 'usr.sbin/switchd')
-rw-r--r--usr.sbin/switchd/control.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/switchd/control.c b/usr.sbin/switchd/control.c
index b5ee43cb4dd..0cf1422c41c 100644
--- a/usr.sbin/switchd/control.c
+++ b/usr.sbin/switchd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.2 2016/07/20 21:01:06 reyk Exp $ */
+/* $OpenBSD: control.c,v 1.3 2016/08/08 16:49:17 rzalamena Exp $ */
/*
* Copyright (c) 2010-2016 Reyk Floeter <reyk@openbsd.org>
@@ -309,7 +309,8 @@ control_dispatch_imsg(int fd, short event, void *arg)
}
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;
}