diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-02-14 10:34:55 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-02-14 10:34:55 +0000 |
commit | 4b0db64d2d26bde05eb494db4679f42d67ebacd5 (patch) | |
tree | 2d50174c94cf132f2d0e3d5658ec720841704a45 | |
parent | 270dbfd7e8a56ae802753ce4cbe587e3a6f74955 (diff) |
Use -1 instead of the less portable INFTIM for the poll timeout.
Result is the same.
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 4 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/bgpd/mrt.c | 9 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.c | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 1140446b90a..bf227599622 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.208 2019/02/11 15:44:25 claudio Exp $ */ +/* $OpenBSD: bgpd.c,v 1.209 2019/02/14 10:34:54 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -262,7 +262,7 @@ 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) + if (timeout == -1 || timeout > MAX_TIMEOUT) timeout = MAX_TIMEOUT; if (poll(pfd, POLL_MAX, timeout * 1000) == -1) diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 882ee119c25..21ad953d3ef 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.365 2019/02/11 15:44:25 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.366 2019/02/14 10:34:54 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1093,7 +1093,6 @@ struct rde_hashstats { #define MRT_FILE_LEN 512 #define MRT2MC(x) ((struct mrt_config *)(x)) -#define MRT_MAX_TIMEOUT 7200 enum mrt_type { MRT_NONE, diff --git a/usr.sbin/bgpd/mrt.c b/usr.sbin/bgpd/mrt.c index c309c28a4b8..1d29a20602f 100644 --- a/usr.sbin/bgpd/mrt.c +++ b/usr.sbin/bgpd/mrt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mrt.c,v 1.89 2019/01/21 02:07:56 claudio Exp $ */ +/* $OpenBSD: mrt.c,v 1.90 2019/02/14 10:34:54 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -914,7 +914,7 @@ mrt_timeout(struct mrt_head *mrt) { struct mrt *m; time_t now; - int timeout = MRT_MAX_TIMEOUT; + int timeout = -1; now = time(NULL); LIST_FOREACH(m, mrt, entry) { @@ -925,11 +925,12 @@ mrt_timeout(struct mrt_head *mrt) MRT2MC(m)->ReopenTimer = now + MRT2MC(m)->ReopenTimerInterval; } - if (MRT2MC(m)->ReopenTimer - now < timeout) + if (timeout == -1 || + MRT2MC(m)->ReopenTimer - now < timeout) timeout = MRT2MC(m)->ReopenTimer - now; } } - return (timeout > 0 ? timeout : 0); + return (timeout); } void diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index e6740487597..00ec75364b7 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.462 2019/02/11 15:44:25 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.463 2019/02/14 10:34:54 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -250,7 +250,7 @@ rde_main(int debug, int verbose) pfd = newp; pfd_elms = PFD_PIPE_COUNT + rde_mrt_cnt; } - timeout = INFTIM; + timeout = -1; bzero(pfd, sizeof(struct pollfd) * pfd_elms); set_pollfd(&pfd[PFD_PIPE_MAIN], ibuf_main); |