From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 37FFA139083 for ; Tue, 12 Dec 2017 18:57:32 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D1B4E0F18; Tue, 12 Dec 2017 18:57:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6CC8EE0F18 for ; Tue, 12 Dec 2017 18:57:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 63E2F341852 for ; Tue, 12 Dec 2017 18:57:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 080E5A1A0 for ; Tue, 12 Dec 2017 18:57:29 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1513104352.9d05f68b51d7b31634cde30a482ec0e3da3b1c21.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/net-online.in X-VCS-Directories: init.d/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 9d05f68b51d7b31634cde30a482ec0e3da3b1c21 X-VCS-Branch: master Date: Tue, 12 Dec 2017 18:57:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6b09aaa8-9cd6-4e1b-b129-3611a8565650 X-Archives-Hash: a884ebc8aee672ef0758335f5a92551c commit: 9d05f68b51d7b31634cde30a482ec0e3da3b1c21 Author: William Hubbs gmail com> AuthorDate: Tue Dec 12 18:45:52 2017 +0000 Commit: William Hubbs gentoo 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