aboutsummaryrefslogtreecommitdiff
path: root/init.d/net-online.in
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-12-11 17:41:04 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-12-11 17:41:04 -0600
commitee2524cd1d0305e207f7dfac52742a1d5e77ea4a (patch)
tree6b7cc9e5d5ce459856c2d299a75a89794b462422 /init.d/net-online.in
parent5c81661d4758dea039860ae2481476a70e78ac47 (diff)
net-online: clean up quoting and test for existence
This is for #178.
Diffstat (limited to 'init.d/net-online.in')
-rw-r--r--init.d/net-online.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/init.d/net-online.in b/init.d/net-online.in
index 41910fa0..cd0cb4e2 100644
--- a/init.d/net-online.in
+++ b/init.d/net-online.in
@@ -44,9 +44,13 @@ start ()
ifcount=0
for dev in ${interfaces}; do
: $((ifcount += 1))
- read carrier < /sys/class/net/$dev/carrier 2> /dev/null
- [ $carrier -eq 1 ] && : $((carriers += 1))
- read operstate < /sys/class/net/$dev/operstate 2> /dev/null
+ carrier=
+ [ -e /sys/class/net/$dev/carrier ] &&
+ read carrier < /sys/class/net/$dev/carrier
+ [ "$carrier" = 1 ] && : $((carriers += 1))
+ operstate=
+ [ -e /sys/class/net/$dev/operstate ] &&
+ read operstate < /sys/class/net/$dev/operstate
[ "$operstate" = up ] && : $((configured += 1))
done
[ $configured -eq $ifcount ] && [ $carriers -ge 1 ] && break