[CRIU] [PATCH 02/11] proc: Get full file path into handle_vma

Pavel Emelyanov xemul at parallels.com
Tue Dec 15 11:24:07 PST 2015


Right now we only get first 31 symbols of it, but in the
next patches full path would be required.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 proc_parse.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/proc_parse.c b/proc_parse.c
index b007c56..042f61b 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -533,8 +533,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list)
 		goto err;
 
 	while (1) {
-		int num;
-		char file_path[32];
+		int num, path_off;
 		bool eof;
 		char *str;
 
@@ -574,10 +573,9 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list)
 		if (!vma_area)
 			goto err;
 
-		memzero(file_path, sizeof(file_path));
-		num = sscanf(str, "%lx-%lx %c%c%c%c %lx %x:%x %lu %31s",
+		num = sscanf(str, "%lx-%lx %c%c%c%c %lx %x:%x %lu %n",
 			     &start, &end, &r, &w, &x, &s, &pgoff,
-			     &vfi.dev_maj, &vfi.dev_min, &vfi.ino, file_path);
+			     &vfi.dev_maj, &vfi.dev_min, &vfi.ino, &path_off);
 		if (num < 10) {
 			pr_err("Can't parse: %s\n", str);
 			goto err;
@@ -604,7 +602,7 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list)
 			goto err;
 		}
 
-		if (handle_vma(pid, vma_area, file_path, map_files_dir,
+		if (handle_vma(pid, vma_area, str + path_off, map_files_dir,
 					&vfi, &prev_vfi, vma_area_list))
 			goto err;
 	}
-- 
1.9.3




More information about the CRIU mailing list