initial bug fix, but just a workaround for error triggered cat of /sys files

This commit is contained in:
inxi-svn 2011-06-23 03:04:01 +00:00
parent 8efdf3199d
commit 35c69c03c8

20
inxi
View file

@ -3,7 +3,7 @@
#### Script Name: inxi
#### version: 1.7.8
#### Date: June 22 2011
#### Patch Number: 02
#### Patch Number: 03
########################################################################
#### SPECIAL THANKS
########################################################################
@ -4319,6 +4319,8 @@ get_network_advanced_data()
# note although this may exist technically don't use it, it's a virtual path
# and causes weird cat errors when there's a missing file as well as a virtual path
# /sys/bus/pci/devices/0000:02:02.0/net/eth1
# real paths are: /sys/devices/pci0000:00/0000:00:1e/0/0000:02:02.0/net/eth1/uevent
# and on older debian kernels: /sys/devices/pci0000:00/0000:02:02.0/net:eth1/uevent
working_path="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}"
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
else
@ -4383,17 +4385,17 @@ get_network_advanced_data()
log_function_data "POST: working_path: $working_path\nif_path: $if_path - if_id: $if_id"
if [[ -n $if_path ]];then
if [[ -f $working_path/speed ]];then
speed=$( cat $working_path/speed )
if [[ -r $working_path/speed ]];then
speed=$( cat $working_path/speed 2>/dev/null )
fi
if [[ -f $working_path/duplex ]];then
duplex=$( cat $working_path/duplex )
if [[ -r $working_path/duplex ]];then
duplex=$( cat $working_path/duplex 2>/dev/null )
fi
if [[ -f $working_path/address ]];then
mac_id=$( cat $working_path/address )
if [[ -r $working_path/address ]];then
mac_id=$( cat $working_path/address 2>/dev/null )
fi
if [[ -f $working_path/operstate ]];then
oper_state=$( cat $working_path/operstate )
if [[ -r $working_path/operstate ]];then
oper_state=$( cat $working_path/operstate 2>/dev/null )
fi
fi