diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2016-09-02 13:41:11 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2016-09-02 13:41:11 +0000 |
commit | 8950a8e1ca1e58eda49307582f4f54e94781b4d9 (patch) | |
tree | 732b91fb9abf4b1c2f1393eff8b21276ecfb2713 /usr.sbin/smtpd | |
parent | 8596610708c7b689a7e0b30ad2f553c9dd9024b3 (diff) |
use imsg_read_nofd() implementation from bgpd.
let the caller handle EAGAIN.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/mproc.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c index d5008cea113..fb3ed3898af 100644 --- a/usr.sbin/smtpd/mproc.c +++ b/usr.sbin/smtpd/mproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mproc.c,v 1.24 2016/09/01 15:12:45 eric Exp $ */ +/* $OpenBSD: mproc.c,v 1.25 2016/09/02 13:41:10 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@faurot.net> @@ -226,16 +226,13 @@ 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); + ibuf->r.wpos += n; + return (n); } void |