[libvirt] [PATCH] esx: Fix regression in absolute file name handling

Eric Blake eblake at redhat.com
Thu May 26 16:45:27 UTC 2011


On 05/26/2011 09:45 AM, Matthias Bolte wrote:
>  
> -        if (datastorePath == NULL) {
> +        /* If it's an absolute path outside of a datastore just use it as is */
> +        if (result == NULL && *fileName == '/') {
> +            /* FIXME: need to deal with Windows paths here too */

#include "dosname.h" // from gnulib, already imported into libvirt

if (result == NULL && IS_ABSOLUTE_FILE_NAME(fileName)) {

and that will properly detect '/' on Unix and 'c:\' on Windows paths
according to what OS that you compiled libvirt to run on.  I am assuming
that the absolute paths in question are residing on the machine where
libvirt is running.

(I'm not familiar enough with esx, so my assumption might be wrong, with
this code being a generic situation of trying to recognize a string as
an absolute path from the point of the view of the machine where the
guest is running, even though libvirt is running on a different system
and will never be able to actually probe if such a file exists.  If so,
then you have to do the parsing work yourself, since
IS_ABSOLUTE_FILE_NAME compiled on Linux won't recognize Windows-style
names as absolute - it only recognizes windows names on mingw or cygwin
- but at least you have dosname.h to give some hints on how to do the
parsing).

> +
> +        result = virBufferContentAndReset(&buffer);
> +    } else if (*fileName == '/') {
> +        /* FIXME: need to deal with Windows paths here too */

And again.

But I don't see anything that would prevent using this patch as-is,
leaving absolute windows names for a subsequent patch; and since it
fixes a regression:

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110526/5a9cc1ae/attachment-0001.sig>


More information about the libvir-list mailing list