mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-14 10:46:58 -07:00
Fix disk_io notification bug
This fixes a bug that makes disk_io stats incorrect and forever increasing, due to the "baseline" stats always being 0.
[This commit](e991e535e4
) intended to catch read failures, but actually just always sets x1 to 0. This is because "read" returns 1 if no newline is read, and the code doesn't write a newline to $cache.
Instead, this just always trusts that read works, as x1 is set even if there's no newline. A more robust way might be via cat.
This commit is contained in:
parent
bfb7a763d0
commit
bfb57bb6c4
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ __disk_io() {
|
|||
if [ $t2 -le $t1 ]; then
|
||||
rate=0
|
||||
else
|
||||
[ -r "$cache" ] && read x1 < "$cache" || x1=0
|
||||
[ -r "$cache" ] && read x1 < "$cache"
|
||||
local a1= a2= a3= a4= a5= a6= a7= a8= a9= a10=
|
||||
read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 other < "/sys/block/$disk/stat"
|
||||
if [ "$i" = "read" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue