浏览代码

overlay: change to normalized, fix error handling

ohrensessel 10 年之前
父节点
当前提交
0e95c90e21
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay

+ 3 - 1
package/gluon-announce/files/lib/gluon/announce/statistics.d/overlay

@@ -2,6 +2,8 @@ local fs = require "nixio.fs"
 local opkg = require "luci.model.ipkg"
 
 local st = fs.statvfs(opkg.overlay_root())
-local used = 100*((st.blocks - st.bfree) / st.blocks) or 0
+local blocks = st.blockss or 0
+local bfree = st.bfree or 0
+local used = ((blocks - bfree) / blocks)
 
 return math.floor(used * 1000 + 0.5) / 1000