From 6f2aa8b0e980a251b178417803edb1088b014897 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Sat, 5 Dec 2015 13:15:28 +0000 Subject: EAGAIN handling for imsg_read. OK henning@ benno@ --- sbin/dhclient/dhclient.c | 4 ++-- sbin/iked/control.c | 5 +++-- sbin/iked/proc.c | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'sbin') diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 9e728550cc7..890586b4823 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.366 2015/11/12 18:46:14 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.367 2015/12/05 13:09:11 claudio Exp $ */ /* * Copyright 2004 Henning Brauer @@ -2014,7 +2014,7 @@ fork_privchld(int fd, int fd2) if (nfds == 0 || !(pfd[0].revents & POLLIN)) continue; - if ((n = imsg_read(priv_ibuf)) == -1) { + if ((n = imsg_read(priv_ibuf)) == -1 && errno != EAGAIN) { warning("imsg_read(priv_ibuf): %s", strerror(errno)); quit = INTERNALSIG; continue; diff --git a/sbin/iked/control.c b/sbin/iked/control.c index e08a2b9a666..32ef9e60397 100644 --- a/sbin/iked/control.c +++ b/sbin/iked/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.20 2015/11/23 19:28:33 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.21 2015/12/05 13:09:46 claudio Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -263,7 +263,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; } diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c index c6948d9a129..32e823e81f6 100644 --- a/sbin/iked/proc.c +++ b/sbin/iked/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.26 2015/11/23 19:28:34 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.27 2015/12/05 13:09:46 claudio Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -456,7 +456,7 @@ proc_dispatch(int fd, short event, void *arg) ibuf = &iev->ibuf; if (event & EV_READ) { - if ((n = imsg_read(ibuf)) == -1) + if ((n = imsg_read(ibuf)) == -1 && errno != EAGAIN) fatal(__func__); if (n == 0) { /* this pipe is dead, so remove the event handler */ -- cgit v1.2.3