check_swap: Use sscanf more precisely to avoid false matches

This commit is contained in:
Lorenz Kästle 2024-11-10 10:36:46 +01:00
parent 651925dffc
commit 77c0913f75

View file

@ -99,7 +99,7 @@ swap_result getSwapFromProcMeminfo(char proc_meminfo[]) {
} else if (sscanf(input_buffer,
"%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %lu "
"%*[k]%*[B]",
str, &tmp_KB)) {
str, &tmp_KB) == 2) {
if (verbose >= 3) {
printf("Got %s with %lu\n", str, tmp_KB);