[CRIU] [PATCH v3 5/6] sysfs_parse: use xsprintf() in fixup_aufs_vma_fd()

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Thu Dec 17 04:29:27 PST 2015


Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 sysfs_parse.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sysfs_parse.c b/sysfs_parse.c
index 93b527d..6497d53 100644
--- a/sysfs_parse.c
+++ b/sysfs_parse.c
@@ -291,11 +291,10 @@ int fixup_aufs_vma_fd(struct vma_area *vma)
 
 	strcpy(vma->aufs_rpath, path);
 	if (opts.root) {
-		vma->aufs_fpath = xmalloc(strlen(opts.root) + 1 + len + 1);
+		/* skip ./ in path */
+		vma->aufs_fpath = xsprintf("%s/%s", opts.root, &path[2]);
 		if (!vma->aufs_fpath)
 			return -1;
-		/* skip ./ in path */
-		sprintf(vma->aufs_fpath, "%s/%s", opts.root, &path[2]);
 	}
 	pr_debug("Saved AUFS paths %s and %s\n", vma->aufs_rpath, vma->aufs_fpath);
 



More information about the CRIU mailing list