projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa7c266
)
ram: Check for theoretical division by zero
author
Aaron Marcher
<me@drkhsh.at>
Fri, 6 Jul 2018 21:38:12 +0000
(23:38 +0200)
committer
Aaron Marcher
<me@drkhsh.at>
Fri, 6 Jul 2018 21:38:12 +0000
(23:38 +0200)
components/ram.c
patch
|
blob
|
history
diff --git
a/components/ram.c
b/components/ram.c
index 74bf337ae601972ff35a772489565525c4021e49..8688349057871d81bad4b7d608f65a7244170916 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);
}