usr/lib/byobu/cpu_temp: test that file exists, is readable, and has

size > 0, LP: #696071
This commit is contained in:
Dustin Kirkland 2011-01-03 11:41:12 -06:00
commit 7ea2c35be1
2 changed files with 4 additions and 2 deletions

2
debian/changelog vendored
View file

@ -14,6 +14,8 @@ byobu (3.20) unreleased; urgency=low
* usr/lib/byobu/cpu_temp: find the temp monitor, LP: #676080
* usr/lib/byobu/battery, usr/share/man/man1/byobu.1: allow for
overriding detected BATTERY, LP: #693560
* usr/lib/byobu/cpu_temp: test that file exists, is readable, and has
size > 0, LP: #696071
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 28 Dec 2010 00:05:13 -0600

View file

@ -34,10 +34,10 @@ fi
for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal $DIR/*/temperature; do
case "$i" in
*temp*_input)
t=$(awk '{printf "%0.f",$1/1000}' "$i")
[ -s "$i" ] && t=$(awk '{printf "%0.f",$1/1000}' "$i")
;;
*)
t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
[ -s "$i" ] && t=$(sed -e "s/^[^0-9]\+//" -e "s/\s.*$//" "$i")
;;
esac
if [ -n "$t" ]; then