This website works better with JavaScript.
Home
Explore
Help
Sign In
rinri
/
slstatus
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
swap_perc: check for division by zero
master
Aaron Marcher
6 years ago
parent
d8ce4e6942
commit
806815778f
1 changed files
with
4 additions
and
0 deletions
Unified View
Diff Options
Show Stats
Download Patch File
Download Diff File
+4
-0
components/swap.c
+ 4
- 0
components/swap.c
View File
@@ -76,6 +76,10 @@
}
}
sscanf(match, "SwapFree: %ld kB\n", &free);
sscanf(match, "SwapFree: %ld kB\n", &free);
if (total == 0) {
return NULL;
}
return bprintf("%d%%", 100 * (total - free - cached) / total);
return bprintf("%d%%", 100 * (total - free - cached) / total);
}
}
Write
Preview
Loading…
Cancel
Save