--- qemu-0.9.0.20070921/block.c.orig 2007-09-21 21:10:53.000000000 +0200 +++ qemu-0.9.0.20070921/block.c 2007-09-22 10:09:32.000000000 +0200 @@ -331,6 +331,7 @@ if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; + BlockDriver *drv1; int64_t total_size; /* if snapshot, we create a temporary backing file and open it @@ -346,10 +347,22 @@ return -1; } total_size = bdrv_getlength(bs1) >> SECTOR_BITS; + drv1 = bs1->drv; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); - realpath(filename, backing_filename); + /* + * for vvfat protocol the string "fat::" should remain + * the prefix of the filename even after realpath() call ... + */ + if (drv1 == &bdrv_vvfat) { + int i = strrchr(filename, ':') - filename + 1; + + strncpy(backing_filename, filename, i); + realpath(filename + i, backing_filename + i); + } else { + realpath(filename, backing_filename); + } if (bdrv_create(&bdrv_qcow2, tmp_filename, total_size, backing_filename, 0) < 0) { return -1;