From 450376ab8c20f993f1c30fcf71b2d64bd9244e6f Mon Sep 17 00:00:00 2001 From: benno Date: Wed, 13 Nov 2013 20:40:24 +0000 Subject: original bug diagnosed by sthen: automatic retry in msgbuf_write on EAGAIN causes spinning. fix from claudio: "Let msgbuf_write return -1 with errno EAGAIN. The users then must check if this was the case and readd the event or poll again. The current handling in the imsg code is wrong for sure." ok gilles --- lib/libutil/imsg-buffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libutil/imsg-buffer.c') diff --git a/lib/libutil/imsg-buffer.c b/lib/libutil/imsg-buffer.c index 9f0475774dd..730959f8c67 100644 --- a/lib/libutil/imsg-buffer.c +++ b/lib/libutil/imsg-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg-buffer.c,v 1.2 2012/06/02 21:46:53 gilles Exp $ */ +/* $OpenBSD: imsg-buffer.c,v 1.3 2013/11/13 20:40:24 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -159,7 +159,7 @@ ibuf_write(struct msgbuf *msgbuf) again: if ((n = writev(msgbuf->fd, iov, i)) == -1) { - if (errno == EAGAIN || errno == EINTR) + if (errno == EINTR) goto again; if (errno == ENOBUFS) errno = EAGAIN; @@ -259,7 +259,7 @@ msgbuf_write(struct msgbuf *msgbuf) again: if ((n = sendmsg(msgbuf->fd, &msg, 0)) == -1) { - if (errno == EAGAIN || errno == EINTR) + if (errno == EINTR) goto again; if (errno == ENOBUFS) errno = EAGAIN; -- cgit v1.2.3-59-g8ed1b