diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-12-05 13:15:28 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2015-12-05 13:15:28 +0000 |
commit | 6f2aa8b0e980a251b178417803edb1088b014897 (patch) | |
tree | 94417c743b25f8e364487235ab5c76915e5bf499 /usr.sbin/bgpd | |
parent | fb1fbb2bee40770f12e27ddf78fdbc55f5d3f4b9 (diff) |
EAGAIN handling for imsg_read. OK henning@ benno@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r-- | usr.sbin/bgpd/control.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 5fc453d2588..5d718308558 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.80 2015/10/25 18:49:01 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.81 2015/12/05 13:10:32 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -219,7 +219,8 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) if (!(pfd->revents & POLLIN)) return (0); - if ((n = imsg_read_nofd(&c->ibuf)) == -1 || n == 0) { + if (((n = imsg_read_nofd(&c->ibuf)) == -1 && errno != EAGAIN) || + n == 0) { *ctl_cnt -= control_close(pfd->fd); return (1); } @@ -529,14 +530,11 @@ imsg_read_nofd(struct imsgbuf *ibuf) buf = ibuf->r.buf + ibuf->r.wpos; len = sizeof(ibuf->r.buf) - ibuf->r.wpos; - again: - if ((n = recv(ibuf->fd, buf, len, 0)) == -1) { - if (errno != EINTR && errno != EAGAIN) - goto fail; - goto again; + while ((n = recv(ibuf->fd, buf, len, 0)) == -1) { + if (errno != EINTR) + return (n); } ibuf->r.wpos += n; - fail: return (n); } |