[hackers] [slstatus] swap_perc: check for division by zero on obsd too || Aaron Marcher

From: <git_AT_suckless.org>
Date: Mon, 21 May 2018 00:02:47 +0200 (CEST)

commit 4bd234c7ef7224117a6e50eda4ce3184338daab1
Author: Aaron Marcher <me_AT_drkhsh.at>
AuthorDate: Mon May 21 00:02:33 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Mon May 21 00:02:33 2018 +0200

    swap_perc: check for division by zero on obsd too

diff --git a/components/swap.c b/components/swap.c
index 465ffd4..f5db667 100644
--- a/components/swap.c
+++ b/components/swap.c
_AT_@ -188,6 +188,10 @@
 
                 getstats(&total, &used);
 
+ if (total == 0) {
+ return NULL;
+ }
+
                 return bprintf("%d%%", 100 * used / total);
         }
 
Received on Mon May 21 2018 - 00:02:47 CEST

This archive was generated by hypermail 2.3.0 : Mon May 21 2018 - 00:12:25 CEST