[libvirt] [PATCH 2/2] Add impl of APIs to get user directories on Win32

Eric Blake eblake at redhat.com
Thu May 24 14:39:54 UTC 2012


On 05/24/2012 07:44 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Add an impl of +virGetUserRuntimeDirectory, virGetUserCacheDirectory
> virGetUserConfigDirectory and virGetUserDirectory for Win32 platform.
> Also create stubs for non-Win32 platforms which lack getpwuid_r()
> 
> In adding these two helpers were added virFileIsAbsPath and
> virFileSkipRoot, along with some macros VIR_FILE_DIR_SEPARATOR,
> VIR_FILE_DIR_SEPARATOR_S, VIR_FILE_IS_DIR_SEPARATOR,
> VIR_FILE_PATH_SEPARATOR, VIR_FILE_PATH_SEPARATOR_S
> 
> All this code was adapted from GLib2 under terms of LGPLv2+ license.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/libvirt_private.syms |    2 +
>  src/util/util.c          |  253 +++++++++++++++++++++++++++++++++++++++++++++-
>  src/util/util.h          |   24 +++++
>  3 files changed, 277 insertions(+), 2 deletions(-)
> 


> @@ -2305,7 +2381,7 @@ static char *virGetGroupEnt(gid_t gid)
>      return ret;
>  }
>  
> -char *virGetUserDirectory()
> +char *virGetUserDirectory(void)

This particular hunk should be squashed into 1/2.

ACK; the code looked generally reasonable.  I note that on WIN32, it
didn't treat 'c:file' as absolute (it's anchored to the C drive, but is
relative to the current directory of that drive, and yes, Windows really
does have 26 current directories, one per drive letter, in addition to
the global current working directory).  But while this might mess up
unusual situations, I'm not sure it is worth worrying about, and this
addition is a strict improvement over the previous behavior of no
support at all.

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

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


More information about the libvir-list mailing list