swap_perc: check for division by zero on obsd too

This commit is contained in:
Aaron Marcher 2018-05-21 00:02:33 +02:00
parent 806815778f
commit 4bd234c7ef

View File

@ -188,6 +188,10 @@
getstats(&total, &used); getstats(&total, &used);
if (total == 0) {
return NULL;
}
return bprintf("%d%%", 100 * used / total); return bprintf("%d%%", 100 * used / total);
} }