From baac79a53c9baf32be60379f07e788da99c8b03f Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Mon, 22 Aug 2011 15:05:34 +0530 Subject: [PATCH] kvm tools, 9p: Fix walk to prepare correct path name Fix walk operation with multiple names. Acked-by: Sasha Levin Signed-off-by: Aneesh Kumar K.V Signed-off-by: Pekka Enberg --- virtio/9p.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/virtio/9p.c b/virtio/9p.c index 869f19f..1682e64 100644 --- a/virtio/9p.c +++ b/virtio/9p.c @@ -294,6 +294,7 @@ static void virtio_p9_walk(struct p9_dev *p9dev, if (nwname) { struct p9_fid *fid = &p9dev->fids[fid_val]; + strcpy(new_fid->path, fid->path); /* skip the space for count */ pdu->write_offset += sizeof(u16); for (i = 0; i < nwname; i++) { @@ -303,13 +304,8 @@ static void virtio_p9_walk(struct p9_dev *p9dev, virtio_p9_pdu_readf(pdu, "s", &str); - /* - * FIXME!! we should add the previous path - * to path component. - */ /* Format the new path we're 'walk'ing into */ - sprintf(tmp, "%s/%.*s", - fid->path, (int)strlen(str), str); + sprintf(tmp, "%s/%s", new_fid->path, str); if (lstat(rel_to_abs(p9dev, tmp, full_path), &st) < 0) goto err_out;