Xinqi Bao's Git
projects
/
slstatus.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
| inline |
side by side
(parent:
fa7c266
)
ram: Check for theoretical division by zero
author
Aaron Marcher <
[email protected]
>
Fri, 6 Jul 2018 21:38:12 +0000
(23:38 +0200)
committer
Aaron Marcher <
[email protected]
>
Fri, 6 Jul 2018 21:38:12 +0000
(23:38 +0200)
components/ram.c
diff
|
blob
|
history
diff --git
a/components/ram.c
b/components/ram.c
index
74bf337
..
8688349
100644
(file)
--- a/
components/ram.c
+++ b/
components/ram.c
@@
-36,6
+36,10
@@
return NULL;
}
+ if (total == 0) {
+ return NULL;
+ }
+
return bprintf("%d", 100 * ((total - free) -
(buffers + cached)) / total);
}