Re: [libvirt] [PATCH 4/5] save domain status during vm creation and remove it on shutdown.

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

 



On Fri, 2008-12-12 at 19:27 +0100, Guido Günther wrote:
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 7804094..d8b87e4 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -182,6 +182,44 @@ qemudAutostartConfigs(struct qemud_driver *driver) {
>      virConnectClose(conn);
>  }
>  
> +
> +/**
> + * qemudRemoveDomainStatus
> + *
> + * remove all state files of a domain from statedir
> + *
> + * Returns 0 on success
> + */
> +static int
> +qemudRemoveDomainStatus(virConnectPtr conn,
> +                        struct qemud_driver *driver,
> +                        virDomainObjPtr vm) 
> +{
> +    int rc = -1;
> +    char *file = NULL;
> +
> +    if (asprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
> +        qemudReportError(conn, vm, NULL, VIR_ERR_NO_MEMORY,
> +                         "%s", _("failed to allocate space for status file"));
> +        goto cleanup;
> +    }

This needs to set file = NULL on error. (Praise the joy that is
asprintf)

David


--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]