summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde.c
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2013-11-13 20:41:02 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2013-11-13 20:41:02 +0000
commit0316e1d621215c88b714fb44d545e7036ef7b363 (patch)
treeebf942169fd05a5c66c7c1ef41e29aa589bd5125 /usr.sbin/bgpd/rde.c
parent039a07e4268022f543e5ab00fd6a369181b26cda (diff)
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, benno
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r--usr.sbin/bgpd/rde.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c
index 87c08136baa..a4786312def 100644
--- a/usr.sbin/bgpd/rde.c
+++ b/usr.sbin/bgpd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.325 2013/08/14 20:34:26 claudio Exp $ */
+/* $OpenBSD: rde.c,v 1.326 2013/11/13 20:41:01 benno Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -291,7 +291,7 @@ rde_main(int pipe_m2r[2], int pipe_s2r[2], int pipe_m2s[2], int pipe_s2rctl[2],
if ((pfd[PFD_PIPE_MAIN].revents & POLLOUT) &&
ibuf_main->w.queued)
- if (msgbuf_write(&ibuf_main->w) < 0)
+ if (msgbuf_write(&ibuf_main->w) <= 0 && errno != EAGAIN)
fatal("pipe write error");
if (pfd[PFD_PIPE_MAIN].revents & POLLIN)
@@ -299,7 +299,7 @@ rde_main(int pipe_m2r[2], int pipe_s2r[2], int pipe_m2s[2], int pipe_s2rctl[2],
if ((pfd[PFD_PIPE_SESSION].revents & POLLOUT) &&
ibuf_se->w.queued)
- if (msgbuf_write(&ibuf_se->w) < 0)
+ if (msgbuf_write(&ibuf_se->w) <= 0 && errno != EAGAIN)
fatal("pipe write error");
if (pfd[PFD_PIPE_SESSION].revents & POLLIN)
@@ -307,7 +307,8 @@ rde_main(int pipe_m2r[2], int pipe_s2r[2], int pipe_m2s[2], int pipe_s2rctl[2],
if ((pfd[PFD_PIPE_SESSION_CTL].revents & POLLOUT) &&
ibuf_se_ctl->w.queued)
- if (msgbuf_write(&ibuf_se_ctl->w) < 0)
+ if (msgbuf_write(&ibuf_se_ctl->w) <= 0 &&
+ errno != EAGAIN)
fatal("pipe write error");
if (pfd[PFD_PIPE_SESSION_CTL].revents & POLLIN)