kvmtool: 9p: fix overapping snprintf

GCC 8.2 gives this warning:

virtio/9p.c: In function ‘virtio_p9_create’:
virtio/9p.c:335:21: error: passing argument 1 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
  ret = snprintf(dfid->path, size, "%s/%s", dfid->path, name);
                 ~~~~^~~~~~                 ~~~~~~~~~~

Fix it by allocating a temporary string with dfid->path content instead
of overwriting it in-place, which is limited in glibc snprintf with the
__restrict qualifier.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Anisse Astier <aastier@freebox.fr>
Signed-off-by: Will Deacon <will.deacon@arm.com>
1 file changed