mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
abdf008640
commit
e3e83f2e21
4 changed files with 21 additions and 13 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue