diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-10 10:36:46 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-10 10:36:46 +0100 |
commit | 77c0913f7577d20fbb8a8ead522199cd079ea122 (patch) | |
tree | b468e1e0058f4f921f5449066dc7de6bdc80c369 | |
parent | 651925dffce258bf71a6717fd3d4e0969f29b6a6 (diff) | |
download | monitoring-plugins-77c0913f7577d20fbb8a8ead522199cd079ea122.tar.gz |
check_swap: Use sscanf more precisely to avoid false matches
-rw-r--r-- | plugins/check_swap.d/swap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/check_swap.d/swap.c b/plugins/check_swap.d/swap.c index 293fdd71..17c4f73b 100644 --- a/plugins/check_swap.d/swap.c +++ b/plugins/check_swap.d/swap.c | |||
@@ -99,7 +99,7 @@ swap_result getSwapFromProcMeminfo(char proc_meminfo[]) { | |||
99 | } else if (sscanf(input_buffer, | 99 | } else if (sscanf(input_buffer, |
100 | "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %lu " | 100 | "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %lu " |
101 | "%*[k]%*[B]", | 101 | "%*[k]%*[B]", |
102 | str, &tmp_KB)) { | 102 | str, &tmp_KB) == 2) { |
103 | 103 | ||
104 | if (verbose >= 3) { | 104 | if (verbose >= 3) { |
105 | printf("Got %s with %lu\n", str, tmp_KB); | 105 | printf("Got %s with %lu\n", str, tmp_KB); |