qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] HMP: snapshot_blkdev can not consider //root/sn


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] HMP: snapshot_blkdev can not consider //root/sn1 and /root/sn1 as the same file
Date: Fri, 15 Nov 2013 09:55:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

On 11/15/2013 09:22 AM, lijun wrote:
> From: Jun Li <address@hidden>
> 
> Hi all,
> 
> snapshot_blkdev can not consider //root/sn1 and /root/sn1 as the same
> file. When file /root/sn1 is the base file, do snapshot using file
> //root/sn1, qemu consider it as a new file. So this will rewrite the
> base file.

Careful.  On cygwin, /root and //root are two different files (and POSIX
allows this).  While qemu hasn't yet been ported to cygwin, we should
not make the task harder by using incorrect ad-hoc normalization.

> +    /* Delete duplicate '/' in filename. */
> +    while (*p != '\0') {

Rather than hand-rolling a loop, you should use realpath() (guaranteed
by POSIX, but not always portable) or its appropriate glib wrapper,
where we can assume that glib will properly account for // being
distinct on platforms where it matters.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]