summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-06-22 03:17:02 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-06-22 03:17:02 +0000
commitecf989c68adb740e98adc7c4994c82995eddf17e (patch)
tree224aad819fdd4d491bbdefb7a4d5eebd99f2bfc1 /usr.sbin
parent812e4a0e725b5e54bed5fd8f4fb84a50f7d297e6 (diff)
so we call realloc() on our pollfd array and the peer_l one when they shrunk
to save memory... yet, that realloc call can fail with ENOMEM ;) don't shrink when (needed + reserve < allocated), but (needed + 2 * reserve < allocated) the longer term goal is of course to not fail at all when a shrink-realloc fails... but that's for later
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bgpd/session.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index e70f99ea77e..f2f334107dd 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.176 2004/06/20 18:35:12 henning Exp $ */
+/* $OpenBSD: session.c,v 1.177 2004/06/22 03:17:01 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -287,7 +287,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers,
}
if (peer_cnt > peer_l_elms ||
- peer_cnt + PEER_L_RESERVE < peer_l_elms) {
+ peer_cnt + 2 * PEER_L_RESERVE < peer_l_elms) {
if ((newp = realloc(peer_l, sizeof(struct peer *) *
peer_cnt + PEER_L_RESERVE)) == NULL) {
/* panic for now */
@@ -303,7 +303,7 @@ session_main(struct bgpd_config *config, struct peer *cpeers,
new_cnt =
PFD_LISTENERS_START + listener_cnt + peer_cnt + ctl_cnt;
if (new_cnt > pfd_elms ||
- new_cnt + PFD_RESERVE < pfd_elms) {
+ new_cnt + 2 * PFD_RESERVE < pfd_elms) {
if ((newp = realloc(pfd, sizeof(struct pollfd) *
(new_cnt + PFD_RESERVE))) == NULL) {
/* panic for now */