]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
Fix wrong scanning of memory.stat
authoralbatross0 <albatross0@gmail.com>
Thu, 29 Sep 2016 11:23:27 +0000 (20:23 +0900)
committeralbatross0 <albatross0@gmail.com>
Thu, 29 Sep 2016 11:23:27 +0000 (20:23 +0900)
Signed-off-by: KUWAZAWA Takuya <albatross0@gmail.com>
bindings.c

index 2f78ab5ebdd3ff7ef85501f2c164a8b374ab86eb..f1044e7ffadcc7ba3c99541e1bb7c3c86291df5b 100644 (file)
@@ -2958,19 +2958,19 @@ static void parse_memstat(char *memstat, unsigned long *cached,
 
        while (*memstat) {
                if (startswith(memstat, "cache")) {
-                       sscanf(memstat + 11, "%lu", cached);
+                       sscanf(memstat + 5, "%lu", cached);
                        *cached /= 1024;
                } else if (startswith(memstat, "active_anon")) {
                        sscanf(memstat + 11, "%lu", active_anon);
                        *active_anon /= 1024;
                } else if (startswith(memstat, "inactive_anon")) {
-                       sscanf(memstat + 11, "%lu", inactive_anon);
+                       sscanf(memstat + 13, "%lu", inactive_anon);
                        *inactive_anon /= 1024;
                } else if (startswith(memstat, "active_file")) {
                        sscanf(memstat + 11, "%lu", active_file);
                        *active_file /= 1024;
                } else if (startswith(memstat, "inactive_file")) {
-                       sscanf(memstat + 11, "%lu", inactive_file);
+                       sscanf(memstat + 13, "%lu", inactive_file);
                        *inactive_file /= 1024;
                } else if (startswith(memstat, "unevictable")) {
                        sscanf(memstat + 11, "%lu", unevictable);