all repos — slstatus @ 806815778fe75f13b569a1b5fe6d6d74a50c89ff

my build of slstatus (tools.suckless.org/slstatus/)

swap_perc: check for division by zero
Aaron Marcher me@drkhsh.at
Sun, 20 May 2018 23:53:26 +0200
commit

806815778fe75f13b569a1b5fe6d6d74a50c89ff

parent

d8ce4e694217bc69e95372f705d023e71dd70115

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M components/swap.ccomponents/swap.c

@@ -76,6 +76,10 @@ return NULL;

} sscanf(match, "SwapFree: %ld kB\n", &free); + if (total == 0) { + return NULL; + } + return bprintf("%d%%", 100 * (total - free - cached) / total); }