diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-24 14:26:53 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-01-24 14:26:53 +0000 |
commit | 28a656a2625424cc0316ba2ace645e32a7ed0086 (patch) | |
tree | 96fee7171808919486601a9db0152c35f094eb70 | |
parent | acb4f4133fe3625855638ae187d2767f373cfb17 (diff) |
Functions in the poll() loop should only be moved around if there are no
side-effects. Revert last changes and make bgpctl reload work again.
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 267511dce32..f6856b263f6 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.131 2006/01/24 10:05:24 henning Exp $ */ +/* $OpenBSD: bgpd.c,v 1.132 2006/01/24 14:26:52 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -278,58 +278,55 @@ main(int argc, char *argv[]) quit = 1; } - if (reconfig) { - reconfig = 0; - log_info("rereading config"); - reconfigure(conffile, &conf, &mrt_l, &peer_l, rules_l); - } - - if (sigchld) { - sigchld = 0; - if (check_child(io_pid, "session engine")) { - quit = 1; - io_pid = 0; - } - if (check_child(rde_pid, "route decision engine")) { - quit = 1; - rde_pid = 0; - } - } - - if (mrtdump == 1) { - mrtdump = 0; - mrt_handler(&mrt_l); - } - - if (nfds == -1 || nfds == 0) - continue; - - if (pfd[PFD_PIPE_SESSION].revents & POLLOUT) + if (nfds > 0 && pfd[PFD_PIPE_SESSION].revents & POLLOUT) if (msgbuf_write(&ibuf_se->w) < 0) { log_warn("pipe write error (to SE)"); quit = 1; } - if (pfd[PFD_PIPE_ROUTE].revents & POLLOUT) + if (nfds > 0 && pfd[PFD_PIPE_ROUTE].revents & POLLOUT) if (msgbuf_write(&ibuf_rde->w) < 0) { log_warn("pipe write error (to RDE)"); quit = 1; } - if (pfd[PFD_PIPE_SESSION].revents & POLLIN) { + if (nfds > 0 && pfd[PFD_PIPE_SESSION].revents & POLLIN) { if (dispatch_imsg(ibuf_se, PFD_PIPE_SESSION) == -1) quit = 1; } - if (pfd[PFD_PIPE_ROUTE].revents & POLLIN) { + if (nfds > 0 && pfd[PFD_PIPE_ROUTE].revents & POLLIN) { if (dispatch_imsg(ibuf_rde, PFD_PIPE_ROUTE) == -1) quit = 1; } - if (pfd[PFD_SOCK_ROUTE].revents & POLLIN) { + if (nfds > 0 && pfd[PFD_SOCK_ROUTE].revents & POLLIN) { if (kr_dispatch_msg() == -1) quit = 1; } + + if (reconfig) { + reconfig = 0; + log_info("rereading config"); + reconfigure(conffile, &conf, &mrt_l, &peer_l, rules_l); + } + + if (sigchld) { + sigchld = 0; + if (check_child(io_pid, "session engine")) { + quit = 1; + io_pid = 0; + } + if (check_child(rde_pid, "route decision engine")) { + quit = 1; + rde_pid = 0; + } + } + + if (mrtdump) { + mrtdump = 0; + mrt_handler(&mrt_l); + } } signal(SIGCHLD, SIG_IGN); |