From e3e83f2e2130a3afbd41a2893d23397f03f6d9d0 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Fri, 16 Sep 2016 08:56:15 +0200 Subject: 9pfs: introduce v9fs_path_sprintf() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helper is similar to v9fs_string_sprintf(), but it includes the terminating NUL character in the size field. This is to avoid doing v9fs_string_sprintf((V9fsString *) &path) and then bumping the size. Affected users are changed to use this new helper. Signed-off-by: Greg Kurz Reviewed-by: Cédric Le Goater --- hw/9pfs/9p-proxy.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'hw/9pfs/9p-proxy.c') diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c index d091564b6f..f2417b7fd7 100644 --- a/hw/9pfs/9p-proxy.c +++ b/hw/9pfs/9p-proxy.c @@ -1023,13 +1023,10 @@ static int proxy_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (dir_path) { - v9fs_string_sprintf((V9fsString *)target, "%s/%s", - dir_path->data, name); + v9fs_path_sprintf(target, "%s/%s", dir_path->data, name); } else { - v9fs_string_sprintf((V9fsString *)target, "%s", name); + v9fs_path_sprintf(target, "%s", name); } - /* Bump the size for including terminating NULL */ - target->size++; return 0; } -- cgit 1.4.1