Explorar el Código

swap_perc: check for division by zero on obsd too

Aaron Marcher hace 7 años
padre
commit
4bd234c7ef
Se han modificado 1 ficheros con 4 adiciones y 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);
 	}