[libvirt] [PATCH 2/3] lxc conf2xml: convert lxc.network.name for veth networks

Michal Privoznik mprivozn at redhat.com
Wed Jul 16 15:10:12 UTC 2014


On 02.07.2014 15:57, Cédric Bosdonnat wrote:
> ---
>   src/lxc/lxc_native.c                               | 22 ++++++++++++++++------
>   .../lxcconf2xmldata/lxcconf2xml-physnetwork.config |  1 +
>   tests/lxcconf2xmldata/lxcconf2xml-simple.xml       |  1 +
>   3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index f4c4556..e14face 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -338,7 +338,8 @@ lxcCreateNetDef(const char *type,
>                   const char *linkdev,
>                   const char *mac,
>                   const char *flag,
> -                const char *macvlanmode)
> +                const char *macvlanmode,
> +                const char *name)
>   {
>       virDomainNetDefPtr net = NULL;
>       virMacAddr macAddr;
> @@ -353,6 +354,8 @@ lxcCreateNetDef(const char *type,
>               net->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN;
>       }
>
> +    if (name && VIR_STRDUP(net->ifname_guest, name) < 0)
> +        goto error;

One of the requirements when I introduced VIR_STRDUP was, that it's NULL 
safe so we don't have to do this. s/name && //

ACK

Michal




More information about the libvir-list mailing list