diff options
author | 2016-09-02 13:28:36 +0000 | |
---|---|---|
committer | 2016-09-02 13:28:36 +0000 | |
commit | 3c5a93c3ddd969e25417012a7390bc47d9bc6cd1 (patch) | |
tree | 1696534af8ca0ce75ed274b834ec76f6c6615b24 | |
parent | After allocating a single 64 KB mbuf cluster in sosend(), the sending (diff) | |
download | wireguard-openbsd-3c5a93c3ddd969e25417012a7390bc47d9bc6cd1.tar.xz wireguard-openbsd-3c5a93c3ddd969e25417012a7390bc47d9bc6cd1.zip |
use imsg_read_nofd() implementation from bgpd.
let the caller handle EAGAIN.
ok reyk@ gilles@
-rw-r--r-- | usr.sbin/snmpd/control.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c index 6fe77497ec8..c4240d14f3b 100644 --- a/usr.sbin/snmpd/control.c +++ b/usr.sbin/snmpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.38 2016/01/25 08:24:30 jsg Exp $ */ +/* $OpenBSD: control.c,v 1.39 2016/09/02 13:28:36 eric Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -688,14 +688,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); } |