File sysconfig-ifplugd-selectif-carrier-error-reporting.bnc637183.diff of Package sysconfig
From 7220fe66c10425f6962e2080a176541df6c681ab Mon Sep 17 00:00:00 2001
From: mt <mt@bf393798-0adf-0310-9952-bd479070b6c1>
Date: Thu, 22 Apr 2010 14:21:42 +0000
Subject: [PATCH 1/2] Throw away errors when reading carrier flag (errors are normal).
git-svn-id: https://svn.suse.de/svn/sysconfig/trunk@2165 bf393798-0adf-0310-9952-bd479070b6c1
Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
scripts/ifplugd-selectif | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/ifplugd-selectif b/scripts/ifplugd-selectif
index f7ee485..5d40ce9 100755
--- a/scripts/ifplugd-selectif
+++ b/scripts/ifplugd-selectif
@@ -37,7 +37,7 @@ get_carrier() {
local -i carrier=0 count=40
local check=/sys/class/net/${1}/carrier
while ((count-- > 0)) ; do
- test -e $check && read -t 1 carrier < $check
+ test -e $check && read -t 1 carrier < $check 2>/dev/null
((carrier == 1)) && break
usleep 25000
done
--
1.7.1
From 0234c1a28d7d187411f9b78c57fbe3986c6ec75f Mon Sep 17 00:00:00 2001
From: Marius Tomaschewski <mt@suse.de>
Date: Tue, 26 Oct 2010 13:16:42 +0200
Subject: [PATCH 2/2] Fixed carrier messages in ifplugd-selectif script
Fixed ifplugd-selectif script to use -1 as default carrier
flag and initialize interface type when unset to correctly
print wireless instead of cable messages (bnc#637183).
Signed-off-by: Marius Tomaschewski <mt@suse.de>
---
scripts/ifplugd-selectif | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/ifplugd-selectif b/scripts/ifplugd-selectif
index 5d40ce9..3f57952 100755
--- a/scripts/ifplugd-selectif
+++ b/scripts/ifplugd-selectif
@@ -34,7 +34,7 @@ test -f ./config && . ./config
# . scripts/extradebug
get_carrier() {
- local -i carrier=0 count=40
+ local -i carrier=-1 count=40
local check=/sys/class/net/${1}/carrier
while ((count-- > 0)) ; do
test -e $check && read -t 1 carrier < $check 2>/dev/null
@@ -54,6 +54,7 @@ fi
INTERFACE=$1
ACTION=$2
INTERFACETYPE=$3 # may be empty
+test -z "$INTERFACETYPE" && INTERFACETYPE=`get_iface_type $INTERFACE`
# Check all available interfaces if they have a ifplugd priority and collect
# two ordered lists of interfaces with minor or major priority.
@@ -166,7 +167,7 @@ case $ACTION in
info_mesg "`printf " %-9s has priority %s" "$INTERFACE" "$PRIORITY"`"
if [ $PRIORITY -gt 0 ] ; then
for IF in $MAJOR; do
- test "`get_carrier $IF`" == 1|| continue
+ test "x`get_carrier $IF`" == x1 || continue
mesg "`printf " %-9s has lesser priority than '%s'" \
"$INTERFACE" "$IF"`"
exit 1
--
1.7.1