[libvirt] PATCH: Latest MinGW patches

Jim Meyering jim at meyering.net
Thu Sep 4 06:24:14 UTC 2008


"Daniel P. Berrange" <berrange at redhat.com> wrote:
> On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
>> I've got a MinGW build environment setup on Fedora 10 now, so just checked
>> out what the latest state of libvirt CVS is.
...
> This new version of the patch fixes two small bugs in the original, and
> also adds the mingw-libvirt.spec.in and makes the autobuild.sh script
> build this RPM too, if mingw build chain is present. THis means we will
> get fully validation of the windows compatability for our nightly builds

Looks fine.

> Index: src/storage_backend.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/storage_backend.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 storage_backend.c
> --- src/storage_backend.c	27 Aug 2008 11:42:52 -0000	1.20
> +++ src/storage_backend.c	3 Sep 2008 16:44:22 -0000
> @@ -24,9 +24,13 @@
>  #include <config.h>
>
>  #include <string.h>
> +#if HAVE_REGEX_H
>  #include <regex.h>
> +#endif
>  #include <sys/types.h>
...

Another option (just to avoid this particular #if/#endif) would
be to add "regexp" to the list of modules pulled in from gnulib.
Probably not worth it right now, though, since the code that would
use it has to remain #ifdef'd out.

...
> Index: src/storage_conf.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/storage_conf.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 storage_conf.c
> --- src/storage_conf.c	3 Sep 2008 07:12:37 -0000	1.13
> +++ src/storage_conf.c	3 Sep 2008 16:44:22 -0000
> @@ -189,7 +189,11 @@ virStoragePoolDefParsePerms(virConnectPt
>      }
>
>      if (virXPathNode(conn, "/pool/permissions/owner", ctxt) == NULL) {
> +#if HAVE_GETUID
>          perms->uid = getuid();
> +#else
> +        perms->uid = 0;
> +#endif
...
> +#if HAVE_GETGID
> +        perms->gid = getgid();
> +#else
> +        perms->gid = 0;
> +#endif
...
> +#if HAVE_GETUID
>          perms->uid = getuid();
> +#else
> +        perms->uid = 0;
> +#endif
...
> +#if HAVE_GETGID
>          perms->gid = getgid();
> +#else
> +        perms->gid = 0;
> +#endif
...
> Index: src/util.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/util.c,v
> retrieving revision 1.56

Instead of adding the #if/else blocks above,
how about adding these in some header file?

#ifndef HAVE_GETGID
static inline gid_t getgid (void) { return 0; }
#endif

#ifndef HAVE_GETUID
static inline uid_t getuid (void) { return 0; }
#endif




More information about the libvir-list mailing list