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 E9C2B139083 for ; Mon, 11 Dec 2017 20:57:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 40DD7E10BA; Mon, 11 Dec 2017 20:57:10 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 1C1C7E10BA for ; Mon, 11 Dec 2017 20:57:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 6372833BF43 for ; Mon, 11 Dec 2017 20:57:09 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 25CCFAE74 for ; Mon, 11 Dec 2017 20:57:08 +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: <1513025176.5c81661d4758dea039860ae2481476a70e78ac47.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: 5c81661d4758dea039860ae2481476a70e78ac47 X-VCS-Branch: master Date: Mon, 11 Dec 2017 20:57:08 +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: d09685db-da9c-402c-879f-d885988435d1 X-Archives-Hash: f43ec36488858f58fbec1e4885579e3b commit: 5c81661d4758dea039860ae2481476a70e78ac47 Author: Marcel Greter ocbnet ch> AuthorDate: Sat Dec 9 22:18:03 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon Dec 11 20:46:16 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=5c81661d Gracefully handle unreadable /sys/class/net/dev/ nodes Fixes https://bugs.gentoo.org/629228 Fixes #189 Fixes #185 Fixes #178 init.d/net-online.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.d/net-online.in b/init.d/net-online.in index 45041c80..41910fa0 100644 --- a/init.d/net-online.in +++ b/init.d/net-online.in @@ -31,7 +31,7 @@ get_interfaces() start () { local carriers configured dev gateway ifcount infinite - local rc state x + local carrier operstate rc ebegin "Checking to see if the network is online" rc=0 @@ -44,10 +44,10 @@ start () ifcount=0 for dev in ${interfaces}; do : $((ifcount += 1)) - read x < /sys/class/net/$dev/carrier - [ $x -eq 1 ] && : $((carriers += 1)) - read x < /sys/class/net/$dev/operstate - [ "$x" = up ] && : $((configured += 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 + [ "$operstate" = up ] && : $((configured += 1)) done [ $configured -eq $ifcount ] && [ $carriers -ge 1 ] && break sleep 1