From 4bd234c7ef7224117a6e50eda4ce3184338daab1 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Mon, 21 May 2018 00:02:33 +0200 Subject: swap_perc: check for division by zero on obsd too --- components/swap.c | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- cgit v1.2.3