summaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-local.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2016-09-16 08:56:15 +0200
committerGreg Kurz <groug@kaod.org>2016-09-16 08:56:15 +0200
commite3e83f2e2130a3afbd41a2893d23397f03f6d9d0 (patch)
tree86663d544b52921e0794a56bd6b88d0616439c66 /hw/9pfs/9p-local.c
parentabdf008640b7ff59ac4c08c85f76ed861290c60e (diff)
downloadqemu-e3e83f2e2130a3afbd41a2893d23397f03f6d9d0.tar.gz
9pfs: introduce v9fs_path_sprintf() helper
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 <groug@kaod.org> Reviewed-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/9pfs/9p-local.c')
-rw-r--r--hw/9pfs/9p-local.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index 3f271fcbd2..845675e7a1 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1060,13 +1060,10 @@ static int local_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;
}