diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-07-06 23:38:12 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-07-06 23:38:12 +0200 |
commit | ab4f24a612fd40bb58b5504e979ad476533dd891 (patch) | |
tree | 4d2e9e8c8699a1ec183b677e35fc20cca6849ac3 | |
parent | fa7c266e2b7adbc2a87bd44057b9e561d9ed61e3 (diff) |
ram: Check for theoretical division by zero
-rw-r--r-- | components/ram.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/components/ram.c b/components/ram.c index 74bf337..8688349 100644 --- 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); } |