diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2016-09-02 13:28:37 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2016-09-02 13:28:37 +0000 |
commit | 3ec703ae186a9e584413b8177c48f84d6dce2bc8 (patch) | |
tree | 6b1aa54c31450518493f5df79e50262760a50ae7 | |
parent | d442c8908f0293f37ea17136bb71c7ade494af3e (diff) |
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); } |