From 1869e46caf56959e43f0adee84af6e6670727079 Mon Sep 17 00:00:00 2001 From: rzalamena Date: Mon, 8 Aug 2016 16:49:17 +0000 Subject: [PATCH] Handle imsg_read() EAGAIN like the man page code example. ok reyk@ --- usr.sbin/switchd/control.c | 5 +++-- 1 file 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 @@ -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; } -- 2.20.1