From 4b0db64d2d26bde05eb494db4679f42d67ebacd5 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Thu, 14 Feb 2019 10:34:55 +0000 Subject: Use -1 instead of the less portable INFTIM for the poll timeout. Result is the same. --- usr.sbin/bgpd/bgpd.c | 4 ++-- usr.sbin/bgpd/bgpd.h | 3 +-- usr.sbin/bgpd/mrt.c | 9 +++++---- usr.sbin/bgpd/rde.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'usr.sbin/bgpd') 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 @@ -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 @@ -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 @@ -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 @@ -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); -- cgit v1.2.3