[libvirt] [PATCH] lxc: return the right value if failed to make path
Michal Privoznik
mprivozn at redhat.com
Fri Dec 6 15:38:13 UTC 2013
On 06.12.2013 07:20, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
>
> If we failed to make path for pts,
> lxcContainerMountFSDevPTS will return the value
> virAsprintf returned rather than -1.
>
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
> src/lxc/lxc_container.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index b1b63fb..2835463 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -952,7 +952,7 @@ static int lxcContainerMountFSDevPTS(virDomainDefPtr def,
> def->name)) < 0)
> return ret;
>
> - if (virFileMakePath("/dev/pts") < 0) {
> + if ((ret = virFileMakePath("/dev/pts")) < 0) {
> virReportSystemError(errno, "%s",
> _("Cannot create /dev/pts"));
> goto cleanup;
>
In fact I'd prefer the pattern we have everywhere else in the libvirt:
{
int ret = -1;
if (..)
goto cleanup;
...
ret = 0;
cleanup:
return ret;
}
So I've tweaked the patch and commit message and pushed it.
Michal
More information about the libvir-list
mailing list