]> git.proxmox.com Git - lxcfs.git/blob - debian/patches/fix-offsets-for-memory.stat-parsing.patch
fix #1173: wrong /proc/meminfo content
[lxcfs.git] / debian / patches / fix-offsets-for-memory.stat-parsing.patch
1 From 145cc4a9922aeabeecce69225c9476aaffe147ad Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
3 Date: Wed, 19 Oct 2016 09:06:59 +0200
4 Subject: [PATCH] fix offsets for memory.stat parsing
5
6 ---
7 bindings.c | 12 ++++++------
8 1 file changed, 6 insertions(+), 6 deletions(-)
9
10 diff --git a/bindings.c b/bindings.c
11 index 2f78ab5..f433ea2 100644
12 --- a/bindings.c
13 +++ b/bindings.c
14 @@ -2958,22 +2958,22 @@ static void parse_memstat(char *memstat, unsigned long *cached,
15
16 while (*memstat) {
17 if (startswith(memstat, "cache")) {
18 - sscanf(memstat + 11, "%lu", cached);
19 + sscanf(memstat + sizeof("cache"), "%lu", cached);
20 *cached /= 1024;
21 } else if (startswith(memstat, "active_anon")) {
22 - sscanf(memstat + 11, "%lu", active_anon);
23 + sscanf(memstat + sizeof("active_anon"), "%lu", active_anon);
24 *active_anon /= 1024;
25 } else if (startswith(memstat, "inactive_anon")) {
26 - sscanf(memstat + 11, "%lu", inactive_anon);
27 + sscanf(memstat + sizeof("inactive_anon"), "%lu", inactive_anon);
28 *inactive_anon /= 1024;
29 } else if (startswith(memstat, "active_file")) {
30 - sscanf(memstat + 11, "%lu", active_file);
31 + sscanf(memstat + sizeof("active_file"), "%lu", active_file);
32 *active_file /= 1024;
33 } else if (startswith(memstat, "inactive_file")) {
34 - sscanf(memstat + 11, "%lu", inactive_file);
35 + sscanf(memstat + sizeof("inactive_file"), "%lu", inactive_file);
36 *inactive_file /= 1024;
37 } else if (startswith(memstat, "unevictable")) {
38 - sscanf(memstat + 11, "%lu", unevictable);
39 + sscanf(memstat + sizeof("unevictable"), "%lu", unevictable);
40 *unevictable /= 1024;
41 }
42 eol = strchr(memstat, '\n');
43 --
44 2.1.4
45