From e4003f04d127f6929ee07e6aad8e930acb071b42 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Wed, 30 Sep 2009 11:59:40 +0000 Subject: carp_demote_ioctl() can handle more then +/-1 steps so there is no need to loop in the shutdown case. OK henning@ --- usr.sbin/ospfd/carp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'usr.sbin/ospfd') diff --git a/usr.sbin/ospfd/carp.c b/usr.sbin/ospfd/carp.c index b633ba01708..d2d4c5041d7 100644 --- a/usr.sbin/ospfd/carp.c +++ b/usr.sbin/ospfd/carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: carp.c,v 1.1 2007/05/29 22:08:25 claudio Exp $ */ +/* $OpenBSD: carp.c,v 1.2 2009/09/30 11:59:39 claudio Exp $ */ /* * Copyright (c) 2006 Henning Brauer @@ -90,9 +90,8 @@ carp_demote_shutdown(void) while ((c = TAILQ_FIRST(&carpgroups)) != NULL) { TAILQ_REMOVE(&carpgroups, c, entry); - for (; c->changed_by > 0; c->changed_by--) - if (c->do_demote) - carp_demote_ioctl(c->group, -1); + if (c->do_demote && c->changed_by > 0) + carp_demote_ioctl(c->group, -c->changed_by); free(c->group); free(c); -- cgit v1.2.3