summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/bgpd.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-02-14 13:13:34 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-02-14 13:13:34 +0000
commitdd14bdf00843467e4603059720bfadb4393a8b45 (patch)
treead18cd534ed3c99d5d1f7f4e07603b4f91959215 /usr.sbin/bgpd/bgpd.c
parent52df606b1f5911fa3ceaec622e99ce94791fb214 (diff)
mrt_timeout should just return -1 when there is no timeout set instead
of some strange maximum. The poll loop in bgpd.c already limits the maximum wait time so there is no need to double it. While there switch to using time_t for the calculation. OK phessler@
Diffstat (limited to 'usr.sbin/bgpd/bgpd.c')
-rw-r--r--usr.sbin/bgpd/bgpd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 79c00368808..1e42d93eb52 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.210 2019/02/14 10:38:04 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.211 2019/02/14 13:13:33 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -102,13 +102,14 @@ main(int argc, char *argv[])
struct bgpd_config *conf;
struct peer *peer_l, *p;
struct pollfd pfd[POLL_MAX];
+ time_t timeout;
pid_t se_pid = 0, rde_pid = 0, pid;
char *conffile;
char *saved_argv0;
int debug = 0;
int rflag = 0, sflag = 0;
int rfd = -1;
- int ch, timeout, status;
+ int ch, status;
int pipe_m2s[2];
int pipe_m2r[2];
@@ -262,9 +263,9 @@ BROKEN if (pledge("stdio rpath wpath cpath fattr unix route recvfd sendfd",
pfd[PFD_SOCK_ROUTE].events = POLLIN;
timeout = mrt_timeout(conf->mrt);
- if (timeout > MAX_TIMEOUT)
- timeout = MAX_TIMEOUT;
+ if (timeout < 0 || timeout > MAX_TIMEOUT)
+ timeout = MAX_TIMEOUT;
if (poll(pfd, POLL_MAX, timeout * 1000) == -1)
if (errno != EINTR) {
log_warn("poll error");