summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric <eric@openbsd.org>2016-09-02 13:41:10 +0000
committereric <eric@openbsd.org>2016-09-02 13:41:10 +0000
commita9171260047c97f5c84a4547f7fed05ecb4e2912 (patch)
tree166d1aa24a8d5960ea2f241cc45b7d0f0bf38756
parentuse imsg_read_nofd() implementation from bgpd. (diff)
downloadwireguard-openbsd-a9171260047c97f5c84a4547f7fed05ecb4e2912.tar.xz
wireguard-openbsd-a9171260047c97f5c84a4547f7fed05ecb4e2912.zip
use imsg_read_nofd() implementation from bgpd.
let the caller handle EAGAIN. ok gilles@
-rw-r--r--usr.sbin/smtpd/mproc.c15
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