summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-09 13:14:26 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-09 13:14:26 +0000
commit6efd43e3888bed7f064187906b7401b1ff38914c (patch)
tree93558272369b5a366f3669c3e0cd4c7edbce8265
parentba221a2187e53f62751f7712abbc226f0f15a2ec (diff)
you must not try to read(2) without checking (pfd->revents & POLLIN)
you must not try to read(2) without checking (pfd->revents & POLLIN) you must not try to read(2) without checking (pfd->revents & POLLIN) [...] you must not try to read(2) without checking (pfd->revents & POLLIN)
-rw-r--r--usr.sbin/bgpd/control.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index ff2571928dc..b889e491834 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.12 2004/01/06 23:14:58 henning Exp $ */
+/* $OpenBSD: control.c,v 1.13 2004/01/09 13:14:25 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -180,6 +180,15 @@ control_dispatch_msg(struct pollfd *pfd, int i)
return (0);
}
+ if (pfd->revents & POLLOUT)
+ if (msgbuf_write(&c->ibuf.w) < 0) {
+ control_close(pfd->fd);
+ return (1);
+ }
+
+ if (!(pfd->revents & POLLIN))
+ return (0);
+
if (imsg_read(&c->ibuf) <= 0) {
control_close(pfd->fd);
return (1);