Merge pull request 'Avoid displaying negative free space' (#28) from df/webif:df-freespace-patch into master

Reviewed-on: hummypkg/webif#28
This commit is contained in:
af123 2021-01-14 21:04:15 +00:00
commit 94849c51e7

View File

@ -9,6 +9,11 @@ lassign [system diskspace 1] size used perc free fperc tsrbuf tsrused
set tsrreserve $($tsrbuf - $tsrused) set tsrreserve $($tsrbuf - $tsrused)
# Adjust values to account for the TSR reserve # Adjust values to account for the TSR reserve
set free $($free - $tsrreserve) set free $($free - $tsrreserve)
# In case the reserve has been over-committed
if {$free < 0} {
# avoid displaying negative free, or used > available
set free 0
}
set used $($size - $free) set used $($size - $free)
set dbs 0 set dbs 0