From 009b03aaa233ccf5bd3014404995540158d7dc93 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Fri, 1 Feb 2019 20:29:13 +0100 Subject: block: Make path_combine() return the path Besides being safe for arbitrary path lengths, after some follow-up patches all callers will want a freshly allocated buffer anyway. In the meantime, path_combine_deprecated() is added which has the same interface as path_combine() had before this patch. All callers to that function will be converted in follow-up patches. Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf Message-id: 20190201192935.18394-10-mreitz@redhat.com Signed-off-by: Max Reitz --- block/vmdk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'block') diff --git a/block/vmdk.c b/block/vmdk.c index 464b718..32e4e75 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -873,8 +873,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, return -EINVAL; } - extent_path = g_malloc0(PATH_MAX); - path_combine(extent_path, PATH_MAX, desc_file_path, fname); + extent_path = path_combine(desc_file_path, fname); ret = snprintf(extent_opt_prefix, 32, "extents.%d", s->num_extents); assert(ret < 32); -- cgit v1.1