Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
Date: Mon, 11 Dec 2017 20:57:15
Message-Id: 1513025176.5c81661d4758dea039860ae2481476a70e78ac47.williamh@OpenRC
1 commit: 5c81661d4758dea039860ae2481476a70e78ac47
2 Author: Marcel Greter <marcel.greter <AT> ocbnet <DOT> ch>
3 AuthorDate: Sat Dec 9 22:18:03 2017 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 11 20:46:16 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5c81661d
7
8 Gracefully handle unreadable /sys/class/net/dev/ nodes
9
10 Fixes https://bugs.gentoo.org/629228
11 Fixes #189
12 Fixes #185
13 Fixes #178
14
15 init.d/net-online.in | 10 +++++-----
16 1 file changed, 5 insertions(+), 5 deletions(-)
17
18 diff --git a/init.d/net-online.in b/init.d/net-online.in
19 index 45041c80..41910fa0 100644
20 --- a/init.d/net-online.in
21 +++ b/init.d/net-online.in
22 @@ -31,7 +31,7 @@ get_interfaces()
23 start ()
24 {
25 local carriers configured dev gateway ifcount infinite
26 - local rc state x
27 + local carrier operstate rc
28
29 ebegin "Checking to see if the network is online"
30 rc=0
31 @@ -44,10 +44,10 @@ start ()
32 ifcount=0
33 for dev in ${interfaces}; do
34 : $((ifcount += 1))
35 - read x < /sys/class/net/$dev/carrier
36 - [ $x -eq 1 ] && : $((carriers += 1))
37 - read x < /sys/class/net/$dev/operstate
38 - [ "$x" = up ] && : $((configured += 1))
39 + read carrier < /sys/class/net/$dev/carrier 2> /dev/null
40 + [ $carrier -eq 1 ] && : $((carriers += 1))
41 + read operstate < /sys/class/net/$dev/operstate 2> /dev/null
42 + [ "$operstate" = up ] && : $((configured += 1))
43 done
44 [ $configured -eq $ifcount ] && [ $carriers -ge 1 ] && break
45 sleep 1