diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2012-07-07 10:28:08 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2012-07-07 10:28:08 +0000 |
commit | 2b12ef652d7f5de8d0051ae3d9fb71a99fe5aae5 (patch) | |
tree | 9d0f13e82a48b4ee045ccba23d0d6434c5df4cd8 | |
parent | 7dc5d0a40458db5084b2d033e8ccec9b23a31629 (diff) |
Simplify rc_wait() (no functionnal change).
initially from robert at peichaer dot org with some enhancement by halex@
ok halex@
-rw-r--r-- | etc/rc.d/rc.subr | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index 11f2be35249..33b2d783a59 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.57 2012/05/30 08:19:14 espie Exp $ +# $OpenBSD: rc.subr,v 1.58 2012/07/07 10:28:07 ajacoutot Exp $ # # Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org> # Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org> @@ -74,9 +74,8 @@ rc_exit() { } rc_wait() { - i=0 - [ -n "$2" ] && w=$2 || w=30 - while [ $i -lt $w ]; do + local _i=0 _w=${2:-30} + while [ $_i -lt $_w ]; do case "$1" in reload|start) rc_do rc_check && return 0 @@ -89,7 +88,7 @@ rc_wait() { ;; esac sleep 1 - i=$((i+1)) + _i=$((_i+1)) done return 1 } |