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 #### Script Name: inxi
#### version: 1.7.8 #### version: 1.7.8
#### Date: June 22 2011 #### Date: June 22 2011
#### Patch Number: 02 #### Patch Number: 03
######################################################################## ########################################################################
#### SPECIAL THANKS #### 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 # 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 # 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 # /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="/sys/bus/pci/devices/0000:${a_network_adv_working[4]}"
# working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent ) # working_path=$( ls /sys/devices/pci*/*/0000:${a_network_adv_working[4]}/net/*/uevent )
else 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" log_function_data "POST: working_path: $working_path\nif_path: $if_path - if_id: $if_id"
if [[ -n $if_path ]];then if [[ -n $if_path ]];then
if [[ -f $working_path/speed ]];then if [[ -r $working_path/speed ]];then
speed=$( cat $working_path/speed ) speed=$( cat $working_path/speed 2>/dev/null )
fi fi
if [[ -f $working_path/duplex ]];then if [[ -r $working_path/duplex ]];then
duplex=$( cat $working_path/duplex ) duplex=$( cat $working_path/duplex 2>/dev/null )
fi fi
if [[ -f $working_path/address ]];then if [[ -r $working_path/address ]];then
mac_id=$( cat $working_path/address ) mac_id=$( cat $working_path/address 2>/dev/null )
fi fi
if [[ -f $working_path/operstate ]];then if [[ -r $working_path/operstate ]];then
oper_state=$( cat $working_path/operstate ) oper_state=$( cat $working_path/operstate 2>/dev/null )
fi fi
fi fi