summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-12-18 00:20:23 -0500
committerMike Frysinger <vapier@gentoo.org>2012-12-18 00:24:02 -0500
commit7557d62870a3ee92ff43e97bab734e2deaf3cb8a (patch)
tree18853cee585c10752daa416c3b7438b03a3f6a92 /init.d
parent2c60282ba9d12040e82e6571c9df8aa1e3da36a2 (diff)
downloadopenrc-7557d62870a3ee92ff43e97bab734e2deaf3cb8a.tar.gz
openrc-7557d62870a3ee92ff43e97bab734e2deaf3cb8a.tar.bz2
openrc-7557d62870a3ee92ff43e97bab734e2deaf3cb8a.tar.xz
net.lo: sleep *after* carrier check
For devices that are always connected (e.g. ethernet cards), the current carrier always wastes time by sleeping for 1 second. This is because the code sleeps first, then checks for carrier. Invert the order so that we return quickly for devices already active. For devices which are not yet up, there shouldn't be any real difference. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'init.d')
-rw-r--r--init.d/net.lo.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index d42b5ae..51833f2 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -116,12 +116,12 @@ _wait_for_carrier()
yesno ${RC_PARALLEL} && efunc=einfo
${efunc} "Waiting for carrier (${timeout} seconds) "
while [ ${timeout} -gt 0 ]; do
- sleep 1
if _has_carrier; then
[ "${efunc}" = "einfon" ] && echo
eend 0
return 0
fi
+ sleep 1
: $(( timeout -= 1 ))
[ "${efunc}" = "einfon" ] && printf "."
done