swap_perc: check for division by zero on obsd too
authorAaron Marcher <me@drkhsh.at>
Sun, 20 May 2018 22:02:33 +0000 (00:02 +0200)
committerAaron Marcher <me@drkhsh.at>
Sun, 20 May 2018 22:02:33 +0000 (00:02 +0200)
components/swap.c

index 465ffd4fc1f412f117a68517cc28bed5b655faf4..f5db66793ae2b5aabfe2883640aa89fc6ade3acd 100644 (file)
 
                getstats(&total, &used);
 
+               if (total == 0) {
+                       return NULL;
+               }
+
                return bprintf("%d%%", 100 * used / total);
        }