diff options
author | Aaron Marcher <me@drkhsh.at> | 2018-05-21 00:02:33 +0200 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2018-05-21 00:02:33 +0200 |
commit | d014ea7d6d0d16c2635b52c3d0858dce357be2d7 (patch) | |
tree | c312bbfd22fda49442ffd409d02aee2eec0f21fd /components/swap.c | |
parent | 53daa64e6abbf226f17e4f7d3e6ebee43ef477f9 (diff) |
swap_perc: check for division by zero on obsd too
Diffstat (limited to 'components/swap.c')
-rw-r--r-- | components/swap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/components/swap.c b/components/swap.c index 465ffd4..f5db667 100644 --- a/components/swap.c +++ b/components/swap.c @@ -188,6 +188,10 @@ getstats(&total, &used); + if (total == 0) { + return NULL; + } + return bprintf("%d%%", 100 * used / total); } |