commit:     9d05f68b51d7b31634cde30a482ec0e3da3b1c21
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Dec 12 18:45:52 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 18:45:52 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9d05f68b

Do not use file tests in net-online

https://unix.stackexchange.com/questions/252002/help-testing-special-file-in-sys-class-net

This is for #189

 init.d/net-online.in | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/init.d/net-online.in b/init.d/net-online.in
index cd0cb4e2..5ea6bf64 100644
--- a/init.d/net-online.in
+++ b/init.d/net-online.in
@@ -44,13 +44,11 @@ start ()
        ifcount=0
        for dev in ${interfaces}; do
                : $((ifcount += 1))
-               carrier=
-               [ -e /sys/class/net/$dev/carrier ] &&
-                       read carrier < /sys/class/net/$dev/carrier
+               read carrier < /sys/class/net/$dev/carrier 2> /dev/null ||
+                       carrier=
                [ "$carrier" = 1 ] && : $((carriers += 1))
-               operstate=
-               [ -e /sys/class/net/$dev/operstate ] &&
-                       read operstate < /sys/class/net/$dev/operstate
+               read operstate < /sys/class/net/$dev/operstate 2> /dev/null ||
+                       operstate=
                [ "$operstate" = up ] && : $((configured += 1))
        done
        [ $configured -eq $ifcount ] && [ $carriers -ge 1 ] && break

Reply via email to