Преглед изворни кода

swap_perc: check for division by zero on obsd too

Aaron Marcher пре 7 година
родитељ
комит
4bd234c7ef
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      components/swap.c

+ 4 - 0
components/swap.c

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