summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2013-11-13 20:40:24 +0000
committerbenno <benno@openbsd.org>2013-11-13 20:40:24 +0000
commit450376ab8c20f993f1c30fcf71b2d64bd9244e6f (patch)
treeb7ffd7f1e8389d162739e7c7876e1eb202785337
parentDo not map frame buffer resources the kernel doesn't use; only keep the (diff)
downloadwireguard-openbsd-450376ab8c20f993f1c30fcf71b2d64bd9244e6f.tar.xz
wireguard-openbsd-450376ab8c20f993f1c30fcf71b2d64bd9244e6f.zip
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
-rw-r--r--lib/libutil/imsg-buffer.c6
1 files changed, 3 insertions, 3 deletions
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 <henning@openbsd.org>
@@ -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;