[libvirt] [PATCH v3 09/34] Adapt to VIR_STRDUP and VIR_STRNDUP in src/lxc/*
Eric Blake
eblake at redhat.com
Wed May 8 22:01:04 UTC 2013
On 05/03/2013 08:53 AM, Michal Privoznik wrote:
> ---
> src/lxc/lxc_cgroup.c | 3 +--
> src/lxc/lxc_conf.c | 36 +++++++++++++++++-------------------
> src/lxc/lxc_container.c | 18 ++++--------------
> src/lxc/lxc_controller.c | 20 ++++++++------------
> src/lxc/lxc_driver.c | 9 ++-------
> src/lxc/lxc_process.c | 7 ++++---
> 6 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> @@ -161,18 +161,18 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
> driver->securityRequireConfined = false;
>
> /* Set the container configuration directory */
> - if ((driver->configDir = strdup(LXC_CONFIG_DIR)) == NULL)
> - goto no_memory;
> - if ((driver->stateDir = strdup(LXC_STATE_DIR)) == NULL)
> - goto no_memory;
> - if ((driver->logDir = strdup(LXC_LOG_DIR)) == NULL)
> - goto no_memory;
> - if ((driver->autostartDir = strdup(LXC_AUTOSTART_DIR)) == NULL)
> - goto no_memory;
> + if (VIR_STRDUP(driver->configDir, LXC_CONFIG_DIR) < 0)
> + goto error;
> + if (VIR_STRDUP(driver->stateDir, LXC_STATE_DIR) < 0)
> + goto error;
> + if (VIR_STRDUP(driver->logDir, LXC_LOG_DIR) < 0)
> + goto error;
> + if (VIR_STRDUP(driver->autostartDir, LXC_AUTOSTART_DIR) < 0)
> + goto error;
You could chain these into one 'if', if desired.
ACK.
--
Eric Blake eblake 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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130508/effc1183/attachment-0001.sig>
More information about the libvir-list
mailing list