Ver código fonte

swap_perc: check for division by zero

master
Aaron Marcher 6 anos atrás
pai
commit
806815778f
1 arquivos alterados com 4 adições e 0 exclusões
  1. +4
    -0
      components/swap.c

+ 4
- 0
components/swap.c Ver arquivo

@@ -76,6 +76,10 @@
}
sscanf(match, "SwapFree: %ld kB\n", &free);

if (total == 0) {
return NULL;
}

return bprintf("%d%%", 100 * (total - free - cached) / total);
}



Carregando…
Cancelar
Salvar