Re: [PATCH] lxc: return the right value if failed to make path

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

 



On 06.12.2013 07:20, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
> 
> If we failed to make path for pts,
> lxcContainerMountFSDevPTS will return the value
> virAsprintf returned rather than -1.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
> ---
>  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

--
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]