Explorar o código

swap_perc: check for division by zero on obsd too

Aaron Marcher %!s(int64=7) %!d(string=hai) anos
pai
achega
4bd234c7ef
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  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);
 	}